public void WriteManagedStructArray() { var marshallingStructs = new RandomMarshallingStructGenerator(1).Structs; using (var extendedStream = new LittleEndianMemoryStream(new Reloaded.Memory.Streams.ExtendedMemoryStream())) { extendedStream.Write(marshallingStructs); Reloaded.Memory.StructArray.FromArray <MarshallingStruct>(extendedStream.ToArray(), out var newStructs, true); Assert.Equal(marshallingStructs, newStructs); }; }
public void WriteStructArray() { var intStructs = new RandomIntStructGenerator(1).Structs; using (var extendedStream = new LittleEndianMemoryStream(new Reloaded.Memory.Streams.ExtendedMemoryStream())) { extendedStream.Write(intStructs); Reloaded.Memory.StructArray.FromArray <RandomIntStruct>(extendedStream.ToArray(), out var newStructs); Assert.Equal(intStructs, newStructs); }; }
public void WriteManagedStruct() { var marshallingStruct = new MarshallingStruct { Name = "Chuck Norris", CompressedSize = 420, UncompressedFileSize = 942 }; using (var extendedStream = new LittleEndianMemoryStream(new Reloaded.Memory.Streams.ExtendedMemoryStream())) { extendedStream.Write(marshallingStruct); Struct.FromArray <MarshallingStruct>(extendedStream.ToArray(), out var newStruct); Assert.Equal(marshallingStruct, newStruct); }; }
public void WriteRegularStruct() { var randomIntStruct = new RandomIntStruct() { A = 1, B = 33, C = 4214 }; using (var extendedStream = new LittleEndianMemoryStream(new Reloaded.Memory.Streams.ExtendedMemoryStream())) { extendedStream.Write(randomIntStruct); Struct.FromArray <RandomIntStruct>(extendedStream.ToArray(), out var newStruct, 0); Assert.Equal(randomIntStruct, newStruct); }; }