Parse cp .dat files. Object schemes.

Test parsing of .msh
This commit is contained in:
bird_egop
2025-08-23 03:00:30 +03:00
parent 67c9020b96
commit b9e15541c5
22 changed files with 515 additions and 166 deletions
-39
View File
@@ -1,39 +0,0 @@
using System.Buffers.Binary;
using System.Text;
namespace ScrLib;
public static class Extensions
{
public static int ReadInt32LittleEndian(this FileStream fs)
{
Span<byte> buf = stackalloc byte[4];
fs.ReadExactly(buf);
return BinaryPrimitives.ReadInt32LittleEndian(buf);
}
public static float ReadFloatLittleEndian(this FileStream fs)
{
Span<byte> buf = stackalloc byte[4];
fs.ReadExactly(buf);
return BinaryPrimitives.ReadSingleLittleEndian(buf);
}
public static string ReadLengthPrefixedString(this FileStream fs)
{
var len = fs.ReadInt32LittleEndian();
if (len == 0)
{
return "";
}
var buffer = new byte[len];
fs.ReadExactly(buffer, 0, len);
return Encoding.ASCII.GetString(buffer, 0, len);
}
}
+3 -1
View File
@@ -1,3 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
</Project>
+3 -1
View File
@@ -1,4 +1,6 @@
namespace ScrLib;
using Common;
namespace ScrLib;
public class ScrParser
{