Exemplo n.º 1
0
        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);
            };
        }
Exemplo n.º 2
0
        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);
            };
        }
Exemplo n.º 3
0
        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);
            };
        }
Exemplo n.º 4
0
        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);
            };
        }