Exemple #1
0
        public int NextInt32()
        {
            var result = BitConverter.ToInt32(Data.Span.Slice(SeekOffset, 4).ToArray(), 0);

            SeekOffset += 4;
            return(ByteOrderConverter.To(Endianness, result));
        }
Exemple #2
0
        public ulong NextUint64()
        {
            var result = BitConverter.ToUInt64(Data.Span.Slice(SeekOffset, 8).ToArray(), 0);

            SeekOffset += 8;
            return(ByteOrderConverter.To(Endianness, result));
        }
Exemple #3
0
        public ushort NextUint16()
        {
            var result = BitConverter.ToUInt16(Data.Span.Slice(SeekOffset, 2).ToArray(), 0);

            SeekOffset += 2;
            return(ByteOrderConverter.To(Endianness, result));
        }
Exemple #4
0
 public void AddInt32(int value)
 {
     EnsureCapacity(4);
     value = ByteOrderConverter.To(Endianness, value);
     foreach (var b in BitConverter.GetBytes(value))
     {
         Data[SeekOffset++] = b;
     }
 }