Example #1
0
        public void WriteArrayMemcpy <T>(T[] r) where T : struct
        {
            int blen = r.Length * Marshal.SizeOf(typeof(T));

            byte[] bl = AddonMemory.ToBytes(r, blen);
            WriteRaw(bl);
        }
Example #2
0
        public T ReadStruct <T>() where T : struct
        {
            var t    = typeof(T);
            int blen = Marshal.SizeOf(t);
            var br   = ReadRawBytes(blen);

            return((T)AddonMemory.FromBytes(t, br));
        }
Example #3
0
        public T[] ReadArray <T>(int count) where T : struct
        {
            int blen = count * Marshal.SizeOf(typeof(T));

            T[] r = new T[count];
            var b = ReadRawBytes(blen);

            AddonMemory.Copy(b, r, blen);
            return(r);
        }
Example #4
0
 public void WriteStruct <T>(T s) where T : struct
 {
     WriteRaw(AddonMemory.ToBytes(s));
 }