Fix mod name parse and add net9

This commit is contained in:
Tretiner 2024-09-28 21:20:11 +05:00
parent d3c5584990
commit 160a085157
4 changed files with 5 additions and 12 deletions

View File

@ -19,13 +19,6 @@ public static class Extensions
(list[i1], list[i2]) = (list[i2], list[i1]);
}
public static Span<byte> TrimEnd(this Span<byte> span, byte val = 0)
{
var i = span.Length - 1;
while (i > 0 && span[i--] == val) ;
return span[..i];
}
public static ExBinaryReader NextAsciiStringMustEqual(this ExBinaryReader binReader, ReadOnlySpan<byte> text)
{
if (!binReader.IsNextAsciiStringEquals(text))

View File

@ -4,13 +4,13 @@
<PackageId>SoulstormReplayReader.Core</PackageId>
<Authors>Bununic</Authors>
<Company>Dowonline</Company>
<Version>1.0.5</Version>
<Version>1.0.6.1</Version>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
<LangVersion>12</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

View File

@ -91,7 +91,7 @@ public sealed class SsReplayReader(Stream stream) : IDisposable
Replay.Version = (ReplayVersion)_binaryReader.ReadInt32();
var modNameSpan = _binaryReader.ReadBytes(stackalloc byte[32]);
Replay.ModName = Encoding.ASCII.GetString(modNameSpan.TrimEnd());
Replay.ModName = Encoding.ASCII.GetString(modNameSpan.TrimEnd<byte>(0));
_binaryReader // relic chunky
.Skip(44)

View File

@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<None Include="TestReplays/*" CopyToOutputDirectory="PreserveNewest"/>
<None Include="TestReplays/**" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>