Ejemplo n.º 1
0
        public void ParseData(LogAnalytics logAnalytics)
        {
            try
            {
                var stopwatch = Stopwatch.StartNew();

                ParsingStatus = ParsingStatus.Parsing;

                var parsedLog = logAnalytics.Parser.ParseLog(FileInfo.FullName);
                var log       = logAnalytics.Processor.ProcessLog(parsedLog);
                var analyzer  = logAnalytics.AnalyzerFactory(log);

                GameLanguage = log.GameLanguage;
                GameBuild    = log.GameBuild;
                EvtcVersion  = log.EvtcVersion;
                PointOfView  = new PointOfView
                {
                    AccountName   = log.PointOfView.AccountName,
                    CharacterName = log.PointOfView.Name
                };
                Encounter        = log.EncounterData.Encounter;
                MapId            = log.MapId;
                MainTargetName   = log.MainTarget?.Name ?? UnknownMainTargetName;
                EncounterResult  = analyzer.GetResult();
                EncounterMode    = analyzer.GetMode();
                HealthPercentage = GetHealthPercentage(log);
                if (EncounterResult == EncounterResult.Success)
                {
                    HealthPercentage = 0;
                }

                var tagEvents = log.Events.OfType <AgentTagEvent>().Where(x => x.Id != 0 && x.Agent is Player);
                Players = analyzer.GetPlayers().Where(x => x.Identified).Select(p =>
                                                                                new LogPlayer(p.Name, p.AccountName, p.Subgroup, p.Profession, p.EliteSpecialization,
                                                                                              GetGuildGuid(p.GuildGuid))
                {
                    Tag = tagEvents.Any(e => e.Agent == p) ? PlayerTag.Commander : PlayerTag.None
                }
                                                                                ).ToArray();

                EncounterStartTime = log.StartTime.ServerTime;
                EncounterDuration  = analyzer.GetEncounterDuration();

                stopwatch.Stop();

                ParseMilliseconds = stopwatch.ElapsedMilliseconds;
                ParseTime         = DateTimeOffset.Now;
                ParsingStatus     = ParsingStatus.Parsed;
            }
            catch (Exception e)
            {
                ParsingStatus    = ParsingStatus.Failed;
                ParsingException = new ExceptionData(e);
            }
            finally
            {
                ParsingVersion = typeof(LogAnalytics).Assembly.GetName().Version;
            }
        }
Ejemplo n.º 2
0
        public void ParseData(LogAnalytics logAnalytics)
        {
            try
            {
                var stopwatch = Stopwatch.StartNew();

                ParsingStatus = ParsingStatus.Parsing;

                var parsedLog = logAnalytics.Parser.ParseLog(FileInfo.FullName);
                var log       = logAnalytics.Processor.ProcessLog(parsedLog);
                var analyzer  = logAnalytics.AnalyzerFactory(log);

                GameLanguage = log.GameLanguage;
                GameBuild    = log.GameBuild;
                EvtcVersion  = log.EvtcVersion;
                PointOfView  = new PointOfView
                {
                    AccountName   = log.PointOfView.AccountName,
                    CharacterName = log.PointOfView.Name
                };
                Encounter       = log.EncounterData.Encounter;
                MapId           = log.MapId;
                MainTargetName  = log.MainTarget?.Name ?? UnknownMainTargetName;
                EncounterResult = analyzer.GetResult();
                EncounterMode   = analyzer.GetMode();
                Players         = analyzer.GetPlayers().Where(x => x.Identified).Select(x =>
                                                                                        new LogPlayer(x.Name, x.AccountName, x.Subgroup, x.Profession, x.EliteSpecialization,
                                                                                                      GetGuildGuid(x.GuildGuid))
                                                                                        ).ToArray();

                EncounterStartTime = log.StartTime.ServerTime;
                EncounterDuration  = analyzer.GetEncounterDuration();

                stopwatch.Stop();

                ParseMilliseconds = stopwatch.ElapsedMilliseconds;
                ParseTime         = DateTimeOffset.Now;
                ParsingStatus     = ParsingStatus.Parsed;
            }
            catch (Exception e)
            {
                ParsingStatus    = ParsingStatus.Failed;
                ParsingException = new ExceptionData(e);
            }
            finally
            {
                ParsingVersion = typeof(LogAnalytics).Assembly.GetName().Version;
            }
        }