示例#1
0
        public TowersofDoom1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, "TowersofDoom1_39445.StormR"));

            _stormReplay = result.Replay;
            _result      = result.Status;
        }
        public LostCavernNonSingleUnit1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, "LostCavernNonSingleUnit1_76517.StormR"));

            _stormReplay = result.Replay;
            _result      = result.Status;
        }
示例#3
0
        public EscapeFromBraxisHeroic1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, "EscapeFromBraxis(Heroic)1_70200.StormR"));

            _stormReplay = result.Replay;
            _result      = result.Status;
        }
        private static void NoGameEvents(StormReplayResult result)
        {
            StormReplay replay = result.Replay !;

            Assert.AreEqual(0, replay.GameEvents.Count);
            Assert.IsNull(replay.Owner?.PlayerHero?.HeroName);
        }
        public AIDragonShire1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, _replayFile));

            _stormReplay = result.Replay;
            _result      = result.Status;
        }
示例#6
0
        private static void ResultLine(StormReplayResult stormReplayResult)
        {
            if (stormReplayResult.Status == StormReplayParseStatus.Success)
            {
                Console.ForegroundColor = ConsoleColor.Green;
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
            }

            if (!_resultOnly)
            {
                Console.WriteLine(stormReplayResult.Status);
                Console.ResetColor();

                if (stormReplayResult.Status != StormReplayParseStatus.Success && stormReplayResult.Exception != null)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(stormReplayResult.Exception.StackTrace);
                    Console.ResetColor();
                    _failed = true;
                }
            }
            else
            {
                Console.Write(stormReplayResult.Status);
                Console.ResetColor();
                Console.WriteLine($" [{Path.GetFileName(stormReplayResult.FileName)}] [{stormReplayResult.Replay.ReplayVersion}]");
            }
        }
示例#7
0
        private static void GetInfo(StormReplayResult stormReplayResult)
        {
            StormReplay replay = stormReplayResult.Replay;

            List <StormPlayer> players = replay.StormPlayers.ToList();

            Console.WriteLine($"{"File Name: ",11}{Path.GetFileName(stormReplayResult.FileName)}");
            Console.WriteLine($"{"Game Mode: ",11}{replay.GameMode}");
            Console.WriteLine($"{"Map: ",11}{replay.MapInfo.MapName} [ID:{replay.MapInfo.MapId}]");
            Console.WriteLine($"{"Version: ",11}{replay.ReplayVersion}");
            Console.WriteLine($"{"Region: ",11}{replay.Region}");
            Console.WriteLine($"{"Game Time: ",11}{replay.ReplayLength}");

            if (_failed)
            {
                Environment.Exit(1);
            }

            IEnumerable <StormPlayer> blueTeam = players.Where(x => x.Team == StormTeam.Blue);
            IEnumerable <StormPlayer> redTeam  = players.Where(x => x.Team == StormTeam.Red);

            List <StormPlayer> playersWithObservers = replay.StormObservers.ToList();

            StormTeamDisplay(replay, blueTeam, StormTeam.Blue);
            StormTeamDisplay(replay, redTeam, StormTeam.Red);
            StormTeamDisplay(replay, playersWithObservers, StormTeam.Observer);
        }
示例#8
0
        public VolskayaFoundry1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, _replayFile));

            _stormReplay = result.Replay;
            _result      = result.Status;
        }
        public MissingWorkSetSlotId1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, _replayFile));

            _stormReplay = result.Replay;
            _result      = result.Status;
        }
        public void NoTrackerEventsParsingTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, _replayFile), new ParseOptions()
            {
                AllowPTR = false,
                ShouldParseGameEvents    = true,
                ShouldParseMessageEvents = true,
                ShouldParseTrackerEvents = false,
            });

            Assert.AreEqual(StormReplayParseStatus.Success, result.Status);

            NoTrackerEvents(result);
        }
示例#11
0
        private static void Parse(string replayPath, bool onlyResult)
        {
            StormReplayResult stormReplayResult = StormReplay.Parse(replayPath, new ParseOptions()
            {
                AllowPTR = true,
                ShouldParseTrackerEvents = true,
                ShouldParseGameEvents    = true,
                ShouldParseMessageEvents = true,
            });

            ResultLine(stormReplayResult);

            if (!onlyResult)
            {
                GetInfo(stormReplayResult);
                Console.WriteLine();
            }
        }
示例#12
0
        public static void Main(string[] args)
        {
            if (args != null && args.Length == 1 && File.Exists(args[0]))
            {
                StormReplayResult stormReplayResult = StormReplay.Parse(args[0], new ParseOptions()
                {
                    AllowPTR = true,
                    ShouldParseGameEvents    = true,
                    ShouldParseMessageEvents = true,
                    ShouldParseTrackerEvents = true,
                });

                Console.WriteLine(stormReplayResult.Status);
            }
            else
            {
                Console.WriteLine("No file.");
            }
        }
        private static void NoTrackerEvents(StormReplayResult result)
        {
            StormReplay replay = result.Replay !;

            Assert.IsNull(result.Replay.MapInfo.MapId);

            Assert.AreEqual(0, replay.TrackerEvents.Count);
            Assert.IsNull(replay.GetTeamLevels(StormTeam.Blue));
            Assert.IsNull(replay.GetTeamLevels(StormTeam.Red));
            Assert.IsNull(replay.GetTeamXPBreakdown(StormTeam.Blue));
            Assert.IsNull(replay.GetTeamXPBreakdown(StormTeam.Red));
            Assert.AreEqual(0, replay.DraftPicks.Count);

            List <StormPlayer> players = replay.StormPlayers.ToList();

            Assert.IsNull(players[0].Talents[0].TalentNameId);
            Assert.IsNull(players[0].ScoreResult);
            Assert.IsNull(players[0].MatchAwards);
            Assert.IsNull(players[0].MatchAwardsCount);
        }
示例#14
0
        public void NoGameEventsParsingTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, _replayFile), new ParseOptions()
            {
                AllowPTR = false,
                ShouldParseGameEvents    = false,
                ShouldParseMessageEvents = true,
                ShouldParseTrackerEvents = true,
            });

            Assert.AreEqual(StormReplayParseStatus.Success, result.Status);
            NoGameEvents(result);

            List <StormPlayer> players = result.Replay.StormPlayers.ToList();

            Assert.AreEqual(6, players[0].Talents.Count);

            Assert.AreEqual("GreymaneInnerBeastViciousness", players[0].Talents[0].TalentNameId);
            Assert.IsNull(players[0].Talents[0].TalentSlotId);
            Assert.IsNull(players[0].Talents[0].Timestamp);

            Assert.AreEqual("GreymaneInnerBeastInsatiable", players[0].Talents[1].TalentNameId);
            Assert.IsNull(players[0].Talents[1].TalentSlotId);
            Assert.IsNull(players[0].Talents[1].Timestamp);

            Assert.AreEqual("GreymaneWorgenFormQuicksilverBullets", players[0].Talents[2].TalentNameId);
            Assert.IsNull(players[0].Talents[2].TalentSlotId);
            Assert.IsNull(players[0].Talents[2].Timestamp);

            Assert.AreEqual("GreymaneHeroicAbilityGoForTheThroat", players[0].Talents[3].TalentNameId);
            Assert.IsNull(players[0].Talents[3].TalentSlotId);
            Assert.IsNull(players[0].Talents[3].Timestamp);

            Assert.AreEqual("GreymaneInnerBeastOnTheProwl", players[0].Talents[4].TalentNameId);
            Assert.IsNull(players[0].Talents[4].TalentSlotId);
            Assert.IsNull(players[0].Talents[4].Timestamp);

            Assert.AreEqual("HeroGenericExecutionerPassive", players[0].Talents[5].TalentNameId);
            Assert.IsNull(players[0].Talents[5].TalentSlotId);
            Assert.IsNull(players[0].Talents[5].Timestamp);
        }
        public void NoGameEventsParsingTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, _replayFile), new ParseOptions()
            {
                AllowPTR = false,
                ShouldParseGameEvents    = false,
                ShouldParseMessageEvents = true,
                ShouldParseTrackerEvents = true,
            });

            Assert.AreEqual(StormReplayParseStatus.Success, result.Status);
            NoGameEvents(result);

            List <StormPlayer> players = result.Replay.StormPlayers.ToList();

            // arthas
            Assert.AreEqual(5, players[6].Talents.Count);

            Assert.AreEqual("ArthasMasteryEternalHungerFrostmourneHungers", players[6].Talents[0].TalentNameId);
            Assert.IsNull(players[6].Talents[0].TalentSlotId);
            Assert.IsNull(players[6].Talents[0].Timestamp);

            Assert.AreEqual("ArthasIcyTalons", players[6].Talents[1].TalentNameId);
            Assert.IsNull(players[6].Talents[1].TalentSlotId);
            Assert.IsNull(players[6].Talents[1].Timestamp);

            Assert.AreEqual("ArthasIceboundFortitude", players[6].Talents[2].TalentNameId);
            Assert.IsNull(players[6].Talents[2].TalentSlotId);
            Assert.IsNull(players[6].Talents[2].Timestamp);

            Assert.AreEqual("ArthasHeroicAbilitySummonSindragosa", players[6].Talents[3].TalentNameId);
            Assert.IsNull(players[6].Talents[3].TalentSlotId);
            Assert.IsNull(players[6].Talents[3].Timestamp);

            Assert.AreEqual("ArthasMasteryFrostStrikeFrostmourneHungers", players[6].Talents[4].TalentNameId);
            Assert.IsNull(players[6].Talents[4].TalentSlotId);
            Assert.IsNull(players[6].Talents[4].Timestamp);
        }
        public HanamuraTemple1ReplayParserTests()
        {
            StormReplayResult result = StormReplay.Parse(Path.Combine(_replaysFolder, "HanamuraTemple1_75132.StormR"));

            _stormReplay = result.Replay;
        }