public static ReadOnlyMemorySlice <byte> ExtractGroupMemory(ReadOnlyMemorySlice <byte> span, GameConstants meta) { var groupMeta = meta.Group(span.Span); var len = groupMeta.ContentLength; len += (byte)meta.GroupConstants.LengthAfterLength; return(span.Slice(meta.GroupConstants.TypeAndLengthLength, checked ((int)len))); }
public WritingBundle(GameConstants constants) { this.Constants = constants; }
public static ReadOnlyMemorySlice <byte> ExtractRecordMemory(ReadOnlyMemorySlice <byte> span, GameConstants meta) { var majorMeta = meta.MajorRecord(span.Span); var len = majorMeta.ContentLength; len += (byte)meta.MajorConstants.LengthAfterLength; return(span.Slice(meta.MajorConstants.TypeAndLengthLength, checked ((int)len))); }
public static ReadOnlyMemorySlice <byte> ExtractSubrecordMemory(ReadOnlyMemorySlice <byte> span, GameConstants meta) { var subMeta = meta.Subrecord(span.Span); return(span.Slice(subMeta.HeaderLength, subMeta.ContentLength)); }
public static ReadOnlySpan <byte> ExtractSubrecordSpan(ReadOnlySpan <byte> span, int loc, GameConstants meta) { var subMeta = meta.Subrecord(span.Slice(loc)); return(span.Slice(loc + subMeta.HeaderLength, subMeta.ContentLength)); }
/// <summary> /// Constructor /// </summary> /// <param name="meta">Game metadata to use as reference for alignment</param> /// <param name="span">Span to overlay on, aligned to the start of the Major Record's header</param> public MajorRecordHeader(GameConstants meta, ReadOnlyMemorySlice <byte> span) { this.Meta = meta; this.HeaderData = span.Slice(0, meta.MajorConstants.HeaderLength); }
/// <summary> /// Constructor /// </summary> /// <param name="meta">Game metadata to use as reference for alignment</param> /// <param name="span">Span to overlay on, aligned to the start of the Major Record's header</param> public MajorRecordHeaderWritable(GameConstants meta, Span <byte> span) { this.Meta = meta; this.HeaderData = span.Slice(0, meta.MajorConstants.HeaderLength); }