示例#1
0
        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)));
        }
示例#2
0
 public WritingBundle(GameConstants constants)
 {
     this.Constants = constants;
 }
示例#3
0
        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)));
        }
示例#4
0
        public static ReadOnlyMemorySlice <byte> ExtractSubrecordMemory(ReadOnlyMemorySlice <byte> span, GameConstants meta)
        {
            var subMeta = meta.Subrecord(span.Span);

            return(span.Slice(subMeta.HeaderLength, subMeta.ContentLength));
        }
示例#5
0
        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));
        }
示例#6
0
 /// <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);
 }
示例#7
0
 /// <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);
 }