Rework metadata struct loading to use new struct versioning

This commit is contained in:
LukeFZ
2024-08-17 13:52:09 +02:00
parent 6c59434984
commit 43d7433e12
69 changed files with 496 additions and 382 deletions

View File

@@ -1,6 +0,0 @@
namespace VersionedSerialization.Attributes;
#pragma warning disable CS9113 // Parameter is unread.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class AlignedAttribute(int alignment) : Attribute;
#pragma warning restore CS9113 // Parameter is unread.

View File

@@ -0,0 +1,3 @@
namespace VersionedSerialization.Attributes;
public class NativeIntegerAttribute : Attribute;

View File

@@ -18,5 +18,6 @@ public interface IReader
T ReadVersionedObject<T>(in StructVersion version = default) where T : IReadable, new();
ImmutableArray<T> ReadVersionedObjectArray<T>(long count, in StructVersion version = default) where T : IReadable, new();
public void Align(int alignment = 0);
void Align(int alignment = 0);
void Skip(int count);
}

View File

@@ -143,4 +143,9 @@ public ref struct SpanReader(ReadOnlySpan<byte> data, int offset = 0, bool littl
if (rem != 0)
Offset += alignment - rem;
}
public void Skip(int count)
{
Offset += count;
}
}