private void ParseHeaderChunk(BinaryReader reader, ref FNReplayReader.Classes.ReplayInformation replayInfo) { var magic = reader.ReadUInt32(); if (magic != NETWORK_MAGIC) { throw new Exception("Cannot parse header."); } var fileVersion = reader.ReadUInt32(); var lengthInMs = reader.ReadUInt32(); var networkVersion = reader.ReadUInt32(); var networkChecksum = reader.ReadUInt32(); var engineNetworkVersion = reader.ReadUInt32(); var gameNetworkProtocol = reader.ReadUInt32(); if (networkVersion > HEADER_GUID) { var guid = reader.ReadGuid(); replayInfo.MatchInformation.SetGameId(guid); } var major = reader.ReadUInt16(); var minor = reader.ReadUInt16(); var patch = reader.ReadUInt16(); var changeList = reader.ReadUInt32(); var branch = reader.ReadFString(); //var levelNamesAndTimes = reader.ReadSpecialArray(); //var flags = reader.ReadUInt32(); //var gameSpecificData = reader.ReadFStringArray(); //STILL WIP }
private void ParseEventData(BinaryReader reader, ref FNReplayReader.Classes.ReplayInformation replayInfo) { var eventId = reader.ReadFString(); var eventGroup = reader.ReadFString(); var eventMetaData = reader.ReadFString(); var startTime = reader.ReadUInt32(); var endTime = reader.ReadUInt32(); var sizeInBytes = reader.ReadUInt32(); var currentPosition = reader.BaseStream.Position; if (eventGroup == "playerElim") { try { ParseEliminationEventData(reader, ref replayInfo); } catch { reader.BaseStream.Position = currentPosition + sizeInBytes; } } if (eventMetaData == "AthenaMatchStats") { reader.SkipBytes(4); replayInfo.PlayerInformation.Accuracy = reader.ReadUInt32(); replayInfo.PlayerInformation.Assists = reader.ReadUInt32(); replayInfo.PlayerInformation.Eliminations = reader.ReadUInt32(); replayInfo.PlayerInformation.WeaponDamageToPlayers = reader.ReadUInt32(); replayInfo.PlayerInformation.OtherDamageToPlayers = reader.ReadUInt32(); replayInfo.PlayerInformation.Revives = reader.ReadUInt32(); replayInfo.PlayerInformation.DamageTaken = reader.ReadUInt32(); replayInfo.PlayerInformation.DamageToStructures = reader.ReadUInt32(); replayInfo.PlayerInformation.MaterialsGathered = reader.ReadUInt32(); replayInfo.PlayerInformation.MaterialsUsed = reader.ReadUInt32(); replayInfo.PlayerInformation.CentimetersTraveled = reader.ReadUInt32(); } else if (eventMetaData == "AthenaMatchTeamStats") { reader.SkipBytes(4); replayInfo.PlayerInformation.Placement = reader.ReadUInt32(); replayInfo.MatchInformation.TotalPlayers = reader.ReadUInt32(); } }