Esempio n. 1
0
        public Match ParseReplay(string path)
        {
            using (var archive = Nmpq.MpqArchive.Open(path))
            {
                try
                {
                    Replay replay = new Replay();

                    ReplayInitData.Parse(replay, archive.ReadFile(InitData));
                    ReplayTrackerEvents.Parse(replay, archive.ReadFile(TrackerEvents));
                    ReplayDetails.Parse(replay, archive.ReadFile(Details));

                    ReplayAttributeEvents.Parse(replay, archive.ReadFile(AttributeEvents));

                    var player = replay.Players.First(p => p.Name == accountName);

                    Match match = new Match();

                    match.FileName = path.Split('\\').Last();
                    match.Map = replay.Map;
                    match.Win = player.IsWinner;
                    match.Character = new Hero(player.Character, replay.ReplayLength);
                    match.TimeStamp = replay.Timestamp;

                    replay = null;

                    return match;
                }
                catch (Exception ex)
                {
                    Logger.Log(string.Format("Error mapping {0}, exception details : {1}", path, ex.ToString()));
                    return null;
                }
            }
        }
 internal void ProcessMatch(Match match)
 {
     matches.Add(match);
 }
Esempio n. 3
0
 public void AddMatch(Match match)
 {
     matches.Add(match);
     changes = true;
 }