コード例 #1
0
        private void InitializeHistory()
        {
            var hasDamage      = this.ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamage") > 0;
            var hasHealing     = this.ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallHealing") > 0;
            var hasDamageTaken = this.ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamageTaken") > 0;

            if (hasDamage || hasHealing || hasDamageTaken)
            {
                StatContainer  currentOverallStats = this.ParseControl.Timeline.Overall.Stats;
                var            historyItem         = new ParseHistoryItem();
                HistoryControl historyController   = historyItem.HistoryControl = new HistoryControl();
                foreach (Stat <double> stat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(stat.Name, stat.Value);
                }

                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDPS", currentOverallStats.GetStatValue("DPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDOTPS", currentOverallStats.GetStatValue("DOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHPS", currentOverallStats.GetStatValue("HPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOHPS", currentOverallStats.GetStatValue("HOHPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOTPS", currentOverallStats.GetStatValue("HOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHMPS", currentOverallStats.GetStatValue("HMPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTPS", currentOverallStats.GetStatValue("DTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTOTPS", currentOverallStats.GetStatValue("DTOTPS"));
                StatGroup[] playerList = this.ParseControl.Timeline.Party.ToArray();
                foreach (StatGroup player in playerList)
                {
                    HistoryGroup playerInstance = historyController.Timeline.GetSetPlayer(player.Name);
                    playerInstance.Last20DamageActions      = ((Player)player).Last20DamageActions.ToList();
                    playerInstance.Last20DamageTakenActions = ((Player)player).Last20DamageTakenActions.ToList();
                    playerInstance.Last20HealingActions     = ((Player)player).Last20HealingActions.ToList();
                    playerInstance.Last20Items = ((Player)player).Last20Items.ToList();
                    foreach (Stat <double> stat in player.Stats)
                    {
                        playerInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }

                    this.RabbitHoleCopy(ref playerInstance, player);
                }

                StatGroup[] monsterList = this.ParseControl.Timeline.Monster.ToArray();
                foreach (StatGroup monster in monsterList)
                {
                    HistoryGroup monsterInstance = historyController.Timeline.GetSetMonster(monster.Name);
                    monsterInstance.Last20DamageActions      = ((Monster)monster).Last20DamageActions.ToList();
                    monsterInstance.Last20DamageTakenActions = ((Monster)monster).Last20DamageTakenActions.ToList();
                    monsterInstance.Last20HealingActions     = ((Monster)monster).Last20HealingActions.ToList();
                    monsterInstance.Last20Items = ((Monster)monster).Last20Items.ToList();
                    foreach (Stat <double> stat in monster.Stats)
                    {
                        monsterInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }

                    this.RabbitHoleCopy(ref monsterInstance, monster);
                }

                historyItem.Start       = this.ParseControl.StartTime;
                historyItem.End         = DateTime.Now;
                historyItem.ParseLength = historyItem.End - historyItem.Start;
                var parseTimeDetails = $"{historyItem.Start} -> {historyItem.End} [{historyItem.ParseLength}]";
                var zone             = "UNKNOWN";
                if (XIVInfoViewModel.Instance.CurrentUser != null)
                {
                    var     mapIndex = XIVInfoViewModel.Instance.CurrentUser.MapIndex;
                    MapItem mapItem  = ZoneLookup.GetZoneInfo(mapIndex);
                    switch (Constants.GameLanguage)
                    {
                    case "French":
                        zone = mapItem.Name.French;
                        break;

                    case "Japanese":
                        zone = mapItem.Name.Japanese;
                        break;

                    case "German":
                        zone = mapItem.Name.German;
                        break;

                    case "Chinese":
                        zone = mapItem.Name.Chinese;
                        break;

                    case "Korean":
                        zone = mapItem.Name.Korean;
                        break;

                    default:
                        zone = mapItem.Name.English;
                        break;
                    }
                }

                var monsterName = "NULL";
                try {
                    StatGroup biggestMonster = null;
                    foreach (StatGroup monster in this.ParseControl.Timeline.Monster)
                    {
                        if (biggestMonster == null)
                        {
                            biggestMonster = monster;
                        }
                        else
                        {
                            if (monster.Stats.GetStatValue("TotalOverallDamage") > biggestMonster.Stats.GetStatValue("TotalOverallDamage"))
                            {
                                biggestMonster = monster;
                            }
                        }
                    }

                    if (biggestMonster != null)
                    {
                        monsterName = biggestMonster.Name;
                    }
                }
                catch (Exception ex) {
                    Logging.Log(Logger, new LogItem(ex, true));
                }

                foreach (Stat <double> oStat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(oStat.Name, oStat.Value);
                }

                historyItem.Name = $"{zone} [{monsterName}] {parseTimeDetails}";
                DispatcherHelper.Invoke(() => MainViewModel.Instance.ParseHistory.Insert(1, historyItem));
            }
        }
コード例 #2
0
            public static void ConvertJson(string fileName, string json)
            {
                JObject jsonHistoryItem = JObject.Parse(json);

                Dictionary <string, JToken> timeline     = GetDictionary(jsonHistoryItem["Timeline"]);
                Dictionary <string, JToken> overall      = GetDictionary(timeline["Overall"]);
                Dictionary <string, JToken> overallStats = GetDictionary(overall["Stats"]);

                var            historyItem       = new ParseHistoryItem();
                HistoryControl historyController = historyItem.HistoryControl = new HistoryControl();

                foreach (KeyValuePair <string, JToken> stat in overallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(stat.Key, (double)stat.Value);
                }

                Dictionary <string, JToken> players = GetDictionary(timeline["Party"]);

                foreach (KeyValuePair <string, JToken> player in players)
                {
                    Dictionary <string, JToken> children = GetDictionary(player.Value);
                    HistoryGroup playerInstance          = historyController.Timeline.GetSetPlayer(player.Key);
                    playerInstance.Last20DamageActions      = children["Last20DamageActions"].ToObject <List <LineHistory> >();
                    playerInstance.Last20DamageTakenActions = children["Last20DamageTakenActions"].ToObject <List <LineHistory> >();
                    playerInstance.Last20HealingActions     = children["Last20HealingActions"].ToObject <List <LineHistory> >();
                    playerInstance.Last20Items = children["Last20Items"].ToObject <List <LineHistory> >();
                    Dictionary <string, JToken> stats = GetDictionary(player.Value["Stats"]);
                    foreach (KeyValuePair <string, JToken> stat in stats)
                    {
                        playerInstance.Stats.EnsureStatValue(stat.Key, (double)stat.Value);
                    }

                    RabbitHoleCopy(ref playerInstance, player);
                }

                Dictionary <string, JToken> monsters = GetDictionary(timeline["Monster"]);

                foreach (KeyValuePair <string, JToken> monster in monsters)
                {
                    Dictionary <string, JToken> children = GetDictionary(monster.Value);
                    HistoryGroup monsterInstance         = historyController.Timeline.GetSetMonster(monster.Key);
                    monsterInstance.Last20DamageActions      = children["Last20DamageActions"].ToObject <List <LineHistory> >();
                    monsterInstance.Last20DamageTakenActions = children["Last20DamageTakenActions"].ToObject <List <LineHistory> >();
                    monsterInstance.Last20HealingActions     = children["Last20HealingActions"].ToObject <List <LineHistory> >();
                    monsterInstance.Last20Items = children["Last20Items"].ToObject <List <LineHistory> >();
                    Dictionary <string, JToken> stats = GetDictionary(monster.Value["Stats"]);
                    foreach (KeyValuePair <string, JToken> stat in stats)
                    {
                        monsterInstance.Stats.EnsureStatValue(stat.Key, (double)stat.Value);
                    }

                    RabbitHoleCopy(ref monsterInstance, monster);
                }

                Match fileNameParts = FileNameRegEx.Match(Path.GetFileNameWithoutExtension(fileName));

                historyItem.Start = DateTime.Now;
                historyItem.End   = DateTime.Now;
                var zone        = "Unknown";
                var monsterName = "NULL";

                try {
                    historyItem.Start = DateTime.Parse(fileNameParts.Groups["startTime"].ToString().Replace("_", ":"));
                    historyItem.End   = DateTime.Parse(fileNameParts.Groups["endTime"].ToString().Replace("_", ":"));
                }
                catch (Exception ex) {
                    Logging.Log(Logger, new LogItem(ex, true));
                }

                try {
                    zone        = fileNameParts.Groups["zone"].ToString();
                    monsterName = fileNameParts.Groups["monsterName"].ToString();
                }
                catch (Exception ex) {
                    Logging.Log(Logger, new LogItem(ex, true));
                }

                historyItem.ParseLength = historyItem.End - historyItem.Start;
                var parseTimeDetails = $"{historyItem.Start} -> {historyItem.End} [{historyItem.ParseLength}]";

                historyItem.Name = $"{zone} [{monsterName}] {parseTimeDetails}";
                DispatcherHelper.Invoke(() => MainViewModel.Instance.ParseHistory.Insert(1, historyItem));
            }
コード例 #3
0
        private void InitializeHistory()
        {
            var hasDamage      = ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamage") > 0;
            var hasHealing     = ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallHealing") > 0;
            var hasDamageTaken = ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamageTaken") > 0;

            if (hasDamage || hasHealing || hasDamageTaken)
            {
                var currentOverallStats = ParseControl.Timeline.Overall.Stats;
                var historyItem         = new ParseHistoryItem();
                var historyController   = historyItem.HistoryControl = new HistoryControl();
                foreach (var stat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(stat.Name, stat.Value);
                }
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDPS", currentOverallStats.GetStatValue("DPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDOTPS", currentOverallStats.GetStatValue("DOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHPS", currentOverallStats.GetStatValue("HPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOHPS", currentOverallStats.GetStatValue("HOHPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOTPS", currentOverallStats.GetStatValue("HOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHMPS", currentOverallStats.GetStatValue("HMPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTPS", currentOverallStats.GetStatValue("DTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTOTPS", currentOverallStats.GetStatValue("DTOTPS"));
                var playerList = ParseControl.Timeline.Party.ToArray();
                foreach (var player in playerList)
                {
                    var playerInstance = historyController.Timeline.GetSetPlayer(player.Name);
                    playerInstance.Last20DamageActions      = ((Player)player).Last20DamageActions.ToList();
                    playerInstance.Last20DamageTakenActions = ((Player)player).Last20DamageTakenActions.ToList();
                    playerInstance.Last20HealingActions     = ((Player)player).Last20HealingActions.ToList();
                    playerInstance.Last20Items = ((Player)player).Last20Items.ToList();
                    foreach (var stat in player.Stats)
                    {
                        playerInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }
                    RabbitHoleCopy(ref playerInstance, player);
                }
                var monsterList = ParseControl.Timeline.Monster.ToArray();
                foreach (var monster in monsterList)
                {
                    var monsterInstance = historyController.Timeline.GetSetMonster(monster.Name);
                    monsterInstance.Last20DamageActions      = ((Monster)monster).Last20DamageActions.ToList();
                    monsterInstance.Last20DamageTakenActions = ((Monster)monster).Last20DamageTakenActions.ToList();
                    monsterInstance.Last20HealingActions     = ((Monster)monster).Last20HealingActions.ToList();
                    monsterInstance.Last20Items = ((Monster)monster).Last20Items.ToList();
                    foreach (var stat in monster.Stats)
                    {
                        monsterInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }
                    RabbitHoleCopy(ref monsterInstance, monster);
                }
                historyItem.Start       = ParseControl.StartTime;
                historyItem.End         = DateTime.Now;
                historyItem.ParseLength = historyItem.End - historyItem.Start;
                var parseTimeDetails = String.Format("{0} -> {1} [{2}]", historyItem.Start, historyItem.End, historyItem.ParseLength);
                var zone             = "Unknown";
                if (PCWorkerDelegate.CurrentUser != null)
                {
                    var mapIndex = PCWorkerDelegate.CurrentUser.MapIndex;
                    zone = ZoneHelper.GetMapInfo(mapIndex)
                           .English;
                    switch (Constants.GameLanguage)
                    {
                    case "French":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .French;
                        break;

                    case "Japanese":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .Japanese;
                        break;

                    case "German":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .German;
                        break;

                    case "Chinese":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .Chinese;
                        break;
                    }
                }
                var monsterName = "NULL";
                try
                {
                    StatGroup biggestMonster = null;
                    foreach (var monster in ParseControl.Timeline.Monster)
                    {
                        if (biggestMonster == null)
                        {
                            biggestMonster = monster;
                        }
                        else
                        {
                            if (monster.Stats.GetStatValue("TotalOverallDamage") > biggestMonster.Stats.GetStatValue("TotalOverallDamage"))
                            {
                                biggestMonster = monster;
                            }
                        }
                    }
                    if (biggestMonster != null)
                    {
                        monsterName = biggestMonster.Name;
                    }
                }
                catch (Exception ex)
                {
                }
                foreach (var oStat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(oStat.Name, oStat.Value);
                }
                historyItem.Name = String.Format("{0} [{1}] {2}", zone, monsterName, parseTimeDetails);
                DispatcherHelper.Invoke(() => MainViewModel.Instance.ParseHistory.Insert(1, historyItem));
            }
        }
コード例 #4
0
            public static void ConvertJson(string fileName, string json)
            {
                var jsonHistoryItem = JObject.Parse(json);

                var timeline     = GetDictionary(jsonHistoryItem["Timeline"]);
                var overall      = GetDictionary(timeline["Overall"]);
                var overallStats = GetDictionary(overall["Stats"]);

                var historyItem       = new ParseHistoryItem();
                var historyController = historyItem.HistoryControl = new HistoryControl();

                foreach (var stat in overallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(stat.Key, (double)stat.Value);
                }
                var players = GetDictionary(timeline["Party"]);

                foreach (var player in players)
                {
                    var children       = GetDictionary(player.Value);
                    var playerInstance = historyController.Timeline.GetSetPlayer(player.Key);
                    playerInstance.Last20DamageActions      = children["Last20DamageActions"].ToObject <List <LineHistory> >();
                    playerInstance.Last20DamageTakenActions = children["Last20DamageTakenActions"].ToObject <List <LineHistory> >();
                    playerInstance.Last20HealingActions     = children["Last20HealingActions"].ToObject <List <LineHistory> >();
                    playerInstance.Last20Items = children["Last20Items"].ToObject <List <LineHistory> >();
                    var stats = GetDictionary(player.Value["Stats"]);
                    foreach (var stat in stats)
                    {
                        playerInstance.Stats.EnsureStatValue(stat.Key, (double)stat.Value);
                    }
                    RabbitHoleCopy(ref playerInstance, player);
                }
                var monsters = GetDictionary(timeline["Monster"]);

                foreach (var monster in monsters)
                {
                    var children        = GetDictionary(monster.Value);
                    var monsterInstance = historyController.Timeline.GetSetMonster(monster.Key);
                    monsterInstance.Last20DamageActions      = children["Last20DamageActions"].ToObject <List <LineHistory> >();
                    monsterInstance.Last20DamageTakenActions = children["Last20DamageTakenActions"].ToObject <List <LineHistory> >();
                    monsterInstance.Last20HealingActions     = children["Last20HealingActions"].ToObject <List <LineHistory> >();
                    monsterInstance.Last20Items = children["Last20Items"].ToObject <List <LineHistory> >();
                    var stats = GetDictionary(monster.Value["Stats"]);
                    foreach (var stat in stats)
                    {
                        monsterInstance.Stats.EnsureStatValue(stat.Key, (double)stat.Value);
                    }
                    RabbitHoleCopy(ref monsterInstance, monster);
                }

                var fileNameParts = FileNameRegEx.Match(Path.GetFileNameWithoutExtension(fileName));

                historyItem.Start = DateTime.Now;
                historyItem.End   = DateTime.Now;
                var zone        = "Unknown";
                var monsterName = "NULL";

                try
                {
                    historyItem.Start = DateTime.Parse(fileNameParts.Groups["startTime"].ToString()
                                                       .Replace("_", ":"));
                    historyItem.End = DateTime.Parse(fileNameParts.Groups["endTime"].ToString()
                                                     .Replace("_", ":"));
                }
                catch (Exception ex)
                {
                }
                try
                {
                    zone        = fileNameParts.Groups["zone"].ToString();
                    monsterName = fileNameParts.Groups["monsterName"].ToString();
                }
                catch (Exception ex)
                {
                }
                historyItem.ParseLength = historyItem.End - historyItem.Start;
                var parseTimeDetails = String.Format("{0} -> {1} [{2}]", historyItem.Start, historyItem.End, historyItem.ParseLength);

                historyItem.Name = String.Format("{0} [{1}] {2}", zone, monsterName, parseTimeDetails);
                DispatcherHelper.Invoke(() => MainViewModel.Instance.ParseHistory.Insert(1, historyItem));
            }