Skip to content

Commit

Permalink
Merge branch 'EPD-Libraries:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders authored Jun 1, 2024
2 parents cc4b331 + a6607e4 commit a673e5a
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/BymlLibrary/Byml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary;

Expand Down
2 changes: 1 addition & 1 deletion src/BymlLibrary/BymlLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="LiteYaml" Version="0.1.0" />
<PackageReference Include="Revrs" Version="1.0.5" />
<PackageReference Include="VYaml" Version="0.25.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/BymlLibrary/Extensions/Utf8Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static class Utf8Extensions
public static unsafe string ToManaged(this Span<byte> utf8)
{
fixed (byte* ptr = utf8) {
return Marshal.PtrToStringUTF8((IntPtr)ptr, utf8.Length);
return Marshal.PtrToStringUTF8((IntPtr)ptr, utf8.Length - 1);
}
}
}
2 changes: 1 addition & 1 deletion src/BymlLibrary/ImmutableByml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Text;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary;

Expand Down
2 changes: 1 addition & 1 deletion src/BymlLibrary/Nodes/Containers/BymlArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BymlLibrary.Yaml;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Containers;

Expand Down
2 changes: 1 addition & 1 deletion src/BymlLibrary/Nodes/Containers/BymlMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Containers;

Expand Down
4 changes: 2 additions & 2 deletions src/BymlLibrary/Nodes/Containers/HashMap/BymlHashMap32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BymlLibrary.Yaml;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Containers.HashMap;

Expand All @@ -19,7 +19,7 @@ public BymlHashMap32(IDictionary<uint, Byml> values) : base(values)

public void EmitYaml(ref Utf8YamlEmitter emitter)
{
emitter.Tag("!h32");
emitter.SetTag("!h32");
emitter.BeginMapping((Count < Byml.YamlConfig.InlineContainerMaxCount && !HasContainerNodes()) switch {
true => MappingStyle.Flow,
false => MappingStyle.Block,
Expand Down
4 changes: 2 additions & 2 deletions src/BymlLibrary/Nodes/Containers/HashMap/BymlHashMap64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BymlLibrary.Yaml;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Containers.HashMap;

Expand All @@ -19,7 +19,7 @@ public BymlHashMap64(IDictionary<ulong, Byml> values) : base(values)

public void EmitYaml(ref Utf8YamlEmitter emitter)
{
emitter.Tag("!h64");
emitter.SetTag("!h64");
emitter.BeginMapping((Count < Byml.YamlConfig.InlineContainerMaxCount && !HasContainerNodes()) switch {
true => MappingStyle.Flow,
false => MappingStyle.Block,
Expand Down
2 changes: 1 addition & 1 deletion src/BymlLibrary/Nodes/Containers/IBymlNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BymlLibrary.Writers;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Containers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Revrs.Extensions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Immutable.Containers.HashMap;

Expand Down Expand Up @@ -102,7 +102,7 @@ public BymlHashMap32 ToMutable(in ImmutableByml root)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void EmitYaml(ref Utf8YamlEmitter emitter, in ImmutableByml root)
{
emitter.Tag("!h32");
emitter.SetTag("!h32");
emitter.BeginMapping((Count < Byml.YamlConfig.InlineContainerMaxCount && !HasContainerNodes()) switch {
true => MappingStyle.Flow,
false => MappingStyle.Block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Revrs.Extensions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Immutable.Containers.HashMap;

Expand Down Expand Up @@ -117,7 +117,7 @@ public static void Reverse(ref RevrsReader reader, int offset, int count, in Has
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void EmitYaml(ref Utf8YamlEmitter emitter, in ImmutableByml root)
{
emitter.Tag("!h64");
emitter.SetTag("!h64");
emitter.BeginMapping((Count < Byml.YamlConfig.InlineContainerMaxCount && !HasContainerNodes()) switch {
true => MappingStyle.Flow,
false => MappingStyle.Block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Revrs;
using Revrs.Extensions;
using System.Runtime.CompilerServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Immutable.Containers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Revrs.Extensions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using VYaml.Emitter;
using LiteYaml.Emitter;

namespace BymlLibrary.Nodes.Immutable.Containers;

Expand Down
2 changes: 1 addition & 1 deletion src/BymlLibrary/Yaml/BymlYamlReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using BymlLibrary.Nodes.Containers.HashMap;
using System.Buffers;
using System.Runtime.CompilerServices;
using VYaml.Parser;
using LiteYaml.Parser;

namespace BymlLibrary.Yaml;

Expand Down
24 changes: 12 additions & 12 deletions src/BymlLibrary/Yaml/BymlYamlWriter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using BymlLibrary.Nodes.Containers;
using BymlLibrary.Nodes.Immutable.Containers;
using LiteYaml.Emitter;
using System.Buffers;
using System.Globalization;
using System.Text;
using VYaml.Emitter;

namespace BymlLibrary.Yaml;

Expand Down Expand Up @@ -56,19 +56,19 @@ public static void Write(ref Utf8YamlEmitter emitter, in ImmutableByml byml, in
WriteFloat(ref emitter, ref formattedFloatBuffer, byml.GetFloat());
break;
case BymlNodeType.UInt32:
emitter.Tag("!u");
emitter.SetTag("!u");
WriteUInt32(ref emitter, ref formattedHexBuffer, byml.GetUInt32());
break;
case BymlNodeType.Int64:
emitter.Tag("!l");
emitter.SetTag("!l");
emitter.WriteInt64(byml.GetInt64());
break;
case BymlNodeType.UInt64:
emitter.Tag("!ul");
emitter.SetTag("!ul");
WriteUInt64(ref emitter, ref formattedHexBuffer, byml.GetUInt64());
break;
case BymlNodeType.Double:
emitter.Tag("!d");
emitter.SetTag("!d");
WriteDouble(ref emitter, ref formattedFloatBuffer, byml.GetDouble());
break;
case BymlNodeType.Changelog:
Expand Down Expand Up @@ -128,19 +128,19 @@ public static void Write(ref Utf8YamlEmitter emitter, in Byml byml)
WriteFloat(ref emitter, ref formattedFloatBuffer, byml.GetFloat());
break;
case BymlNodeType.UInt32:
emitter.Tag("!u");
emitter.SetTag("!u");
WriteUInt32(ref emitter, ref formattedHexBuffer, byml.GetUInt32());
break;
case BymlNodeType.Int64:
emitter.Tag("!l");
emitter.SetTag("!l");
emitter.WriteInt64(byml.GetInt64());
break;
case BymlNodeType.UInt64:
emitter.Tag("!ul");
emitter.SetTag("!ul");
WriteUInt64(ref emitter, ref formattedHexBuffer, byml.GetUInt64());
break;
case BymlNodeType.Double:
emitter.Tag("!d");
emitter.SetTag("!d");
WriteDouble(ref emitter, ref formattedFloatBuffer, byml.GetDouble());
break;
case BymlNodeType.Changelog:
Expand Down Expand Up @@ -193,20 +193,20 @@ private static void WriteUInt64(ref Utf8YamlEmitter emitter, ref Span<byte> form

private static void WriteBinary(ref Utf8YamlEmitter emitter, Span<byte> data)
{
emitter.Tag("!!binary");
emitter.SetTag("!!binary");
emitter.WriteString(
Convert.ToBase64String(data)
);
}

private static void WriteBinaryAligned(ref Utf8YamlEmitter emitter, in Span<byte> data, int alignment)
{
emitter.Tag("!!file");
emitter.SetTag("!!file");
emitter.BeginMapping(MappingStyle.Flow);
emitter.WriteString("Alignment");
emitter.WriteInt32(alignment);
emitter.WriteString("Data");
emitter.Tag("!!binary");
emitter.SetTag("!!binary");
emitter.WriteString(Convert.ToBase64String(data));
emitter.EndMapping();
}
Expand Down

0 comments on commit a673e5a

Please sign in to comment.