Beispiel #1
0
        public static T[] ReadArray <T>(this BinaryReader reader, int size) where T : struct
        {
            int numBytes = FastStruct <T> .Size * size;

            byte[] result = reader.ReadBytes(numBytes);

            return(FastStruct <T> .ReadArray(result));
        }
Beispiel #2
0
 public T GetValue <T>() where T : struct
 {
     unsafe
     {
         fixed(byte *ptr = Value)
         return(FastStruct <T> .ArrayToStructure(ref ptr[0]));
     }
 }
Beispiel #3
0
        public static T[] ReadArray <T>(this BinaryReader reader) where T : struct
        {
            int numBytes = (int)reader.ReadInt64();

            byte[] result = reader.ReadBytes(numBytes);

            reader.BaseStream.Position += (0 - numBytes) & 0x07;
            return(FastStruct <T> .ReadArray(result));
        }
Beispiel #4
0
        public static T Read <T>(this BinaryReader reader) where T : struct
        {
            byte[] result = reader.ReadBytes(FastStruct <T> .Size);

            return(FastStruct <T> .ArrayToStructure(result));
        }