public void ReadDemoFrameIntoPlaybackPacketsTest(string data)
        {
            using var stream  = File.Open(data, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            using var archive = new Unreal.Core.BinaryReader(stream)
                  {
                      EngineNetworkVersion = EngineNetworkVersionHistory.HISTORY_OPTIONALLY_QUANTIZE_SPAWN_INFO,
                      NetworkVersion       = NetworkVersionHistory.HISTORY_CHARACTER_MOVEMENT_NOINTERP,
                      ReplayHeaderFlags    = ReplayHeaderFlags.HasStreamingFixes
                  };
            archive.EngineNetworkVersion = EngineNetworkVersionHistory.HISTORY_OPTIONALLY_QUANTIZE_SPAWN_INFO;
            archive.NetworkVersion       = NetworkVersionHistory.HISTORY_CHARACTER_MOVEMENT_NOINTERP;
            archive.ReplayHeaderFlags    = ReplayHeaderFlags.HasStreamingFixes;

            var reader = new MockReplayReader();

            reader.SetReplay(new MockReplay
            {
                Header = new ReplayHeader
                {
                    EngineNetworkVersion = EngineNetworkVersionHistory.HISTORY_OPTIONALLY_QUANTIZE_SPAWN_INFO,
                    NetworkVersion       = NetworkVersionHistory.HISTORY_CHARACTER_MOVEMENT_NOINTERP,
                    Flags = ReplayHeaderFlags.HasStreamingFixes
                }
            });

            reader.ReadDemoFrameIntoPlaybackPackets(archive);
            Assert.True(archive.AtEnd());
            Assert.False(archive.IsError);
        }
        public void DecryptTest()
        {
            byte[] rawData =
            {
                0xBD, 0x84, 0x4B, 0x84, 0x9B, 0xA6, 0x2D, 0x14, 0x02, 0x10, 0x1D, 0xB3,
                0xB6, 0xA1, 0x45, 0xE2, 0x34, 0x13, 0x7E, 0x42, 0x27, 0x39, 0xDE, 0xC4,
                0x54, 0x8F, 0xBF, 0xA3, 0x3E, 0xCA, 0xC2, 0xA6, 0x02, 0x2F, 0x72, 0xC8,
                0x47, 0x92, 0xB4, 0x40, 0x11, 0x10, 0x0D, 0x2F, 0xA9, 0xB3, 0x03, 0x8C,
                0x32, 0xB8, 0xF8, 0x6F, 0x84, 0x5E, 0x6C, 0xE3, 0x41, 0xE0, 0xF2, 0xBA,
                0xFF, 0xC9, 0x1E, 0x3F, 0xE3, 0x2D, 0xD5, 0xAB, 0x85, 0x2B, 0xFF, 0x62,
                0x7E, 0xB9, 0x70, 0xFC, 0x34, 0x54, 0x2C, 0xFC, 0x8E, 0x34, 0x3F, 0xB1,
                0x92, 0xB2, 0xD5, 0xD7, 0x18, 0x1D, 0x66, 0x81, 0x61, 0x29, 0xAE, 0x04,
                0x2F, 0xDE, 0xEB, 0x70, 0x2D, 0xD0, 0x03, 0xAF, 0x29, 0x25, 0x77, 0x49,
                0x98, 0xF4, 0xF0, 0xD3, 0x79, 0x69, 0x3B, 0xE0, 0x06, 0x49, 0x18, 0x47,
                0xE7, 0xBF, 0x1E, 0x13, 0xE3, 0x62, 0xB4, 0x44
            };

            using var archive = new Unreal.Core.BinaryReader(new MemoryStream(rawData))
                  {
                      EngineNetworkVersion = Unreal.Core.Models.Enums.EngineNetworkVersionHistory.LATEST, // 16
                  };
            var reader = new MockReplayReader()
            {
                Branch = "++Fortnite+Release-12.00"
            };

            reader.SetReplay(new Models.FortniteReplay()
            {
                Info = new Unreal.Core.Models.ReplayInfo()
                {
                    IsEncrypted   = true,
                    EncryptionKey = new byte[] {
                        0xEE, 0x14, 0x20, 0xF9, 0x1C, 0x54, 0x38, 0x2F, 0x10, 0x66, 0xFA, 0xC1,
                        0x56, 0xB0, 0x6E, 0xBC, 0x14, 0xFA, 0xCE, 0xEF, 0xCB, 0xFB, 0xB2, 0xE6,
                        0x78, 0xC5, 0x77, 0xE8, 0xD4, 0x5B, 0xF3, 0x5C
                    }
                }
            });
            var result = reader.DecryptBuffer(archive, 128);

            Assert.True(archive.AtEnd());
            Assert.False(archive.IsError);

            reader.ParseElimination(result, new Unreal.Core.Models.EventInfo {
                StartTime = 0
            });
            Assert.True(result.AtEnd());
            Assert.False(result.IsError);
        }
        public void ReadEventTest(byte[] rawData)
        {
            using var stream  = new MemoryStream(rawData);
            using var archive = new Unreal.Core.BinaryReader(stream);
            var reader = new MockReplayReader();

            reader.SetReplay(new FortniteReplay()
            {
                Info = new ReplayInfo()
                {
                    IsEncrypted = false
                }
            });
            reader.ReadEvent(archive);

            Assert.True(archive.AtEnd());
            Assert.False(archive.IsError);
        }
Exemplo n.º 4
0
        public void ReadPacketTest(byte[] rawData, PacketState state)
        {
            using var stream  = new MemoryStream(rawData);
            using var archive = new Unreal.Core.BinaryReader(stream);
            var reader = new MockReplayReader();

            reader.SetReplay(new MockReplay
            {
                Header = new ReplayHeader
                {
                    EngineNetworkVersion = EngineNetworkVersionHistory.HISTORY_OPTIONALLY_QUANTIZE_SPAWN_INFO,
                    NetworkVersion       = NetworkVersionHistory.HISTORY_CHARACTER_MOVEMENT_NOINTERP,
                    Flags = ReplayHeaderFlags.HasStreamingFixes
                }
            });
            var result = reader.ReadPacket(archive);

            Assert.True(archive.AtEnd());
            Assert.False(archive.IsError);
            Assert.Equal(state, result);
        }
        public void ReadReplayHeader(byte[] rawData, ReplayVersionHistory replayVersionHistory)
        {
            using MemoryStream stream  = new MemoryStream(rawData);
            using BinaryReader archive = new Unreal.Core.BinaryReader(stream)
                  {
                      ReplayVersion = replayVersionHistory,
                  };
            MockReplayReader reader = new MockReplayReader();

            reader.SetReplay(new MockReplay
            {
                Info = new ReplayInfo
                {
                    IsEncrypted  = false,
                    IsCompressed = false,
                }
            });
            reader.ReadReplayData(archive, 0);
            Assert.True(archive.AtEnd());
            Assert.False(archive.IsError);
        }
        public void ReadEventTestThrows()
        {
            byte[] rawData =
            {
                0x43, 0x00, 0x00, 0x00, 0x55, 0x6E, 0x73, 0x61, 0x76, 0x65, 0x64, 0x52, 0x65,
                0x70, 0x6C, 0x61, 0x79, 0x2D, 0x32, 0x30, 0x31, 0x39, 0x2E, 0x31, 0x31, 0x2E,
                0x31, 0x38, 0x2D, 0x32, 0x30, 0x2E, 0x33, 0x36, 0x2E, 0x31, 0x33, 0x5F, 0x42,
                0x43, 0x35, 0x38, 0x32, 0x44, 0x44, 0x41, 0x34, 0x42, 0x42, 0x31, 0x43, 0x38,
                0x45, 0x34, 0x30, 0x37, 0x36, 0x32, 0x46, 0x31, 0x39, 0x39, 0x38, 0x45, 0x43,
                0x44, 0x44, 0x43, 0x34, 0x30, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x70, 0x6C, 0x61,
                0x79, 0x65, 0x72, 0x45, 0x6C, 0x69, 0x44, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x76,
                0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6E, 0x74,
                0x00, 0x66, 0xD3, 0x13, 0x00, 0x66, 0xD3, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00
            };
            using var stream  = new MemoryStream(rawData);
            using var archive = new Unreal.Core.BinaryReader(stream)
                  {
                      EngineNetworkVersion = EngineNetworkVersionHistory.HISTORY_JITTER_IN_HEADER
                  };
            var reader = new MockReplayReader();

            reader.SetReplay(new FortniteReplay()
            {
                Info = new ReplayInfo()
                {
                    IsEncrypted = false
                }
            });
            reader.SetMode(ParseMode.Debug);

            Assert.Throws <UnknownEventException>(() => reader.ReadEvent(archive));

            archive.Reset();
            reader.SetMode(ParseMode.Normal);

            var exception = Record.Exception(() => reader.ReadEvent(archive));

            Assert.Null(exception);
        }