Exemplo n.º 1
0
        public void Parse(ICLIFlags toolFlags)
        {
            var lootboxes = GetLootboxes();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(lootboxes, flags);
                    return;
                }
            }

            var iD = new IndentHelper();

            foreach (var lootboxSet in lootboxes)
            {
                Log($"{iD}{lootboxSet.Key}");
                foreach (var lootbox in lootboxSet.Value)
                {
                    Log($"{iD+1}{lootbox}");
                }

                Log();
            }
        }
Exemplo n.º 2
0
        public void Parse(ICLIFlags toolFlags)
        {
            List <Achievement> data = GetData();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    OutputJSON(data, flags);
                    return;
                }
            }

            foreach (Achievement achievement in data)
            {
                var iD = new IndentHelper();

                Log($"{achievement.Name}");
                if (!(toolFlags as ListFlags).Simplify)
                {
                    Log($"{iD + 1}Description: {achievement.Description}");

                    if (achievement.Reward != null)
                    {
                        Log($"{iD + 1}Reward: {achievement.Reward.Name} ({achievement.Reward.Rarity} {achievement.Reward.Type})");
                    }

                    Log();
                }
            }
        }
Exemplo n.º 3
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <teResourceGUID, string[]> subtitles = GetSubtitles();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    OutputJSON(subtitles, flags);
                    return;
                }
            }

            IndentHelper i = new IndentHelper();

            foreach (KeyValuePair <teResourceGUID, string[]> subtitle in subtitles)
            {
                Log($"{subtitle.Key}");
                foreach (string s in subtitle.Value)
                {
                    Log($"{i+1}{s}");
                }
                Log();
            }
        }
Exemplo n.º 4
0
        public void Parse(ICLIFlags toolFlags)
        {
            var data = GetData();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    OutputJSON(data, flags);
                    return;
                }
            }

            IndentHelper indentLevel = new IndentHelper();

            foreach (var loadout in data)
            {
                Log($"{indentLevel}{loadout.Value.Name}:");
                if (!(toolFlags as ListFlags).Simplify)
                {
                    Log($"{indentLevel + 1}       Type: {loadout.Value.Category}");
                    Log($"{indentLevel + 1}     Button: {loadout.Value.Button ?? "None"}");
                    Log($"{indentLevel + 1}Description: {loadout.Value.Description}");
                    Log();
                }
            }
        }
Exemplo n.º 5
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <string, SubtitleInfo> subtitles = GetSubtitles();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(subtitles, flags);
                    return;
                }
            }

            IndentHelper indentLevel = new IndentHelper();

            foreach (KeyValuePair <string, SubtitleInfo> subtitle in subtitles)
            {
                Log($"{subtitle.Key}");
                foreach (string s in subtitle.Value.Subtitles)
                {
                    Log($"{indentLevel+1}{s}");
                }
                Log();
            }
        }
Exemplo n.º 6
0
        private static void ParseMaps(IndentHelper iD, STUGUID mapBinding)
        {
            if (mapBinding == null)
            {
                return;
            }
            try {
                var map = GetInstance <STUMapDataBinding>(mapBinding);
                if (map?.MapMetadatas == null)
                {
                    return;
                }

                var mapNames = new List <string>();
                foreach (var guid in map.MapMetadatas)
                {
                    var mapMeta = GetInstance <STUMap>(guid);
                    if (mapMeta == null)
                    {
                        continue;
                    }

                    var mapName = GetString(mapMeta.DisplayName);
                    mapNames.Add(mapName);
                }

                Log($"{iD}Maps: {String.Join(", ", mapNames)}");
            } catch { }
        }
Exemplo n.º 7
0
        public void Parse(ICLIFlags toolFlags)
        {
            List <Achievement> achievements = GetAchievements();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(achievements, flags);
                    return;
                }
            }

            foreach (Achievement achievement in achievements)
            {
                var iD = new IndentHelper();

                Log($"{achievement.Name}");
                Log($"{iD+1}Description: {achievement.Description}");

                if (achievement.Reward != null)
                {
                    Log($"{iD+1}Reward: {achievement.Reward.Name} ({achievement.Reward.Rarity} {achievement.Reward.Type})");
                }

                Log();
            }
        }
Exemplo n.º 8
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <teResourceGUID, MapHeader> maps = GetMaps();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    OutputJSON(maps, flags);
                    return;
                }
            }

            var iD = new IndentHelper();

            foreach (var map in maps)
            {
                var data = map.Value;

                Log($"{iD}{data.GetUniqueName()} ({data.MapGUID:X8})");

                if (!string.IsNullOrEmpty(data.Name))
                {
                    Log($"{iD+1}Name: {data.Name}");
                }
                if (!string.IsNullOrEmpty(data.VariantName))
                {
                    Log($"{iD+1}VariantName: {data.VariantName}");
                }
                if (!string.IsNullOrEmpty(data.Description))
                {
                    Log($"{iD+1}Desc1: {data.Description}");
                }
                if (!string.IsNullOrEmpty(data.Description2))
                {
                    Log($"{iD+1}Desc2: {data.Description2}");
                }
                Log($"{iD+1}Status: {data.State}");
                Log($"{iD+1}Type: {data.MapType}");

                if (data.StateA != null || data.StateB != null)
                {
                    Log($"{iD+1}States:");
                    Log($"{iD+2}{data.StateA ?? "N/A"}");
                    Log($"{iD+2}{data.StateB ?? "N/A"}");
                }

                if (data.GameModes != null)
                {
                    Log($"{iD+1}GameModes:");

                    foreach (var gameModeLight in data.GameModes)
                    {
                        Console.Out.WriteLine($"{iD+2}{gameModeLight.Name ?? "N/A"} ({teResourceGUID.AsString(gameModeLight.GUID)})");
                    }
                }

                Log();
            }
        }
Exemplo n.º 9
0
        protected virtual void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            Log("Error parsing query:");
            Log($"{indent + 1}Command format: \"{{hero name}}|{{type}}=({{tag name}}={{tag}}),{{item name}}\"");
            Log(
                $"{indent + 1}Each query should be surrounded by \", and individual queries should be seperated by spaces");

            Log("\r\nTypes:");
            foreach (QueryType argType in types)
            {
                Log($"{indent + 1}{argType.Name}");
            }

            Log("\r\nTags:");

            foreach (QueryType argType in types)
            {
                if (argType.Tags == null)
                {
                    continue;
                }
                foreach (QueryTag argTypeTag in argType.Tags)
                {
                    Log($"{indent + 1}{argTypeTag.Name}:");
                    foreach (string option in argTypeTag.Options)
                    {
                        Log($"{indent + 2}{option}");
                    }
                }
                break; // erm, ok
            }
        }
Exemplo n.º 10
0
        private static void ParseCompetitiveInfo(IndentHelper iD, STUBrawlCompetitiveSeasonBase competitiveInfo)
        {
            if (competitiveInfo == null)
            {
                return;
            }
            Log($"{iD}Is Comp: true");

            if (competitiveInfo.CompetitorRewards != null)
            {
                Log($"{iD}Competitor Rewards:");
                foreach (var guid in competitiveInfo.CompetitorRewards.Unlocks)
                {
                    var unlock = GatherUnlock(guid);
                    if (unlock != null)
                    {
                        Log($"{iD+1}{unlock.Name} ({unlock.Rarity} {unlock.Type})");
                    }
                }
            }

            if (competitiveInfo.TopRewards != null)
            {
                Log($"{iD}Top Rewards:");
                foreach (var guid in competitiveInfo.TopRewards.Unlocks)
                {
                    var unlock = GatherUnlock(guid);
                    if (unlock != null)
                    {
                        Log($"{iD+1}{unlock.Name} ({unlock.Rarity} {unlock.Type})");
                    }
                }
            }
        }
Exemplo n.º 11
0
            public void DumpSTU(ISTU stu, string instanceWildcard)
            {
                IndentHelper indentHelper = new IndentHelper();
                int          index        = 0;

                Console.Out.WriteLine($"Instances: [array] Count={stu.Instances.Count()}");
                foreach (STUInstance instance in stu.Instances)
                {
                    if (instance == null)
                    {
                        index++;
                        continue;
                    }
                    if (instance.Usage != InstanceUsage.Root)
                    {
                        index++;
                        continue;
                    }
                    string[] instanceChecksums = instance.GetType().GetCustomAttributes <STUAttribute>().Select(x => Convert.ToString(x.Checksum, 16)).ToArray();
                    if (instanceWildcard != null && !instanceChecksums.Any(x => string.Equals(x, instanceWildcard.TrimStart('0'), StringComparison.InvariantCultureIgnoreCase)))
                    {
                        continue;
                    }

                    Console.Out.WriteLine($"{indentHelper + 1}[{index}]: [{instance.GetType().Name}]");
                    Console.Out.WriteLine(DumpInstance(instance, indentHelper + 2, new List <object>()));
                    index++;
                }
            }
Exemplo n.º 12
0
            private string DumpInstance(object instance, IndentHelper indentHelper, List <object> recursionGuard)
            {
                if (instance == null)
                {
                    return($"{indentHelper}STU_: unregistered");
                }
                FieldInfo[] fields = GetFields(instance.GetType()).Where(
                    fieldInfo => fieldInfo.GetCustomAttribute <STUFieldAttribute>()?.Checksum > 0).ToArray();

                string        ret               = "";
                string        lineStart         = "";
                List <object> newRecursionGuard = new List <object>(recursionGuard)
                {
                    instance
                };

                foreach (FieldInfo field in fields)
                {
                    if (field == null)
                    {
                        continue;
                    }
                    STUFieldAttribute element        = field.GetCustomAttribute <STUFieldAttribute>();
                    string            fieldNameThing = element.Name == null ? $"{element.Checksum:X8}" : $"{element.Name}";
                    ret      += $"{lineStart}{indentHelper}{field.DeclaringType?.Name}.{field.Name}|{fieldNameThing}: {DumpField(field, field.GetValue(instance), indentHelper, newRecursionGuard)}";
                    lineStart = "\r\n";
                }
                return(ret);
            }
Exemplo n.º 13
0
 public void PrintHighlightInfoJSON(HighlightInfoJSON info, IndentHelper indent)
 {
     Log($"{indent}Player: {info.Player}");
     Log($"{indent}Hero: {info.Hero}");
     Log($"{indent}Skin: {info.Skin}");
     Log($"{indent}Weapon: {info.WeaponSkin}");
     Log($"{indent}HighlightType: {info.HighlightType}");
 }
Exemplo n.º 14
0
        private AnalyzerConfigBuilder CreateAnalyzerConfigBuilder()
        {
            if (DefaultInfoImportance.HasValue)
            {
                LogTraceMessage(IndentHelper.Indent($"DefaultInfoImportance={DefaultInfoImportance}", 1));
            }

            return(new AnalyzerConfigBuilder().SetDefaultInfoImportance(DefaultInfoImportance));
        }
Exemplo n.º 15
0
        private ConfigLoadResult CombineFileConfigProvidersAndSaveResult()
        {
            _lastInheritanceDepth = InheritanceDepth;
            _lastConfigLoadResult = CombineFileConfigProviders();

            LogTraceMessage(IndentHelper.Indent("Effective config:", 1).Concat(IndentHelper.Indent(_lastConfigLoadResult.ToStrings(), 2)));

            return(_lastConfigLoadResult);
        }
Exemplo n.º 16
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <string, MapInfo> maps = GetMaps();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(maps, flags);
                    return;
                }
            }

            var iD = new IndentHelper();

            foreach (KeyValuePair <string, MapInfo> map in maps)
            {
                var data = map.Value;

                Log($"{iD}{data.Name ?? map.Key}");
                Log($"{iD+1}Key: {GUID.Index(data.MetadataGUID):X}");

                if (!string.IsNullOrEmpty(data.NameB))
                {
                    Log($"{iD+1}Alt Name: {data.NameB}");
                }

                if (!string.IsNullOrEmpty(data.Description))
                {
                    Log($"{iD+1}Desc: {data.Description}");
                }
                if (!string.IsNullOrEmpty(data.DescriptionB))
                {
                    Log($"{iD+1}DescB: {data.DescriptionB}");
                }
                if (!string.IsNullOrEmpty(data.Subline))
                {
                    Log($"{iD+1}Subline: {data.Subline}");
                }

                if (data.StateA != null || data.StateB != null)
                {
                    Log($"{iD+1}States:");
                    Log($"{iD+2}{data.StateA}");
                    Log($"{iD+2}{data.StateB}");
                }

                if (data.Gamemodes != null)
                {
                    Log($"{iD+1}Gamemodes:");
                    data.Gamemodes.ForEach(m => Log($"{iD+2}{m.Name}"));
                }

                Log();
            }
        }
Exemplo n.º 17
0
        public void Parse(ICLIFlags toolFlags)
        {
            Log("Gamemodes:");
            var i = 0;

            foreach (var key in TrackedFiles[0xC7])
            {
                var thing = GetInstance <STUBrawl>(key);

                if (thing == null)
                {
                    continue;
                }

                var iD      = new IndentHelper();
                var name    = GetString(thing.Name);
                var subline = GetString(thing.Subline);

                Log($"{iD+1}[{i}] {name}:");
                Log($"{iD+2}Subline: {subline}");

                i++;

                if (thing.Difficulty != null)
                {
                    Log($"{iD+2}Difficulty: {GetString(thing.Difficulty)}");
                }

                if (thing.DifficultySubline != null)
                {
                    Log($"{iD + 2}Difficulty Subline: {GetString(thing.DifficultySubline)}");
                }

                if (thing.BrawlName != null)
                {
                    var brawl = GetInstance <STUBrawlName>(thing.BrawlName);
                    if (brawl != null)
                    {
                        Log($"{iD + 2}Brawl: {GetString(brawl.Name)}");
                    }
                }

                var subIndent = iD + 2;
                ParseAchievements(subIndent, thing.Achievements);
                ParseCompetitiveInfo(subIndent, thing.CompetitiveInfo);
                ParseUnlocks(subIndent, thing.Achievements);
                ParseInfo(subIndent, thing.Info);
                ParseGamemodeInfo(subIndent, thing.GameModeInfo);
                ParseMaps(subIndent, thing.MapBinding);
                ParseBrawls(subIndent, thing.BrawlInfo);

                Log("\n");
            }
        }
Exemplo n.º 18
0
 private static void ParseInfo(IndentHelper iD, STUGUID[] info)
 {
     if (info == null)
     {
         return;
     }
     Log($"{iD}Info:");
     foreach (var guid in info)
     {
         Log($"{iD+1}{GetString(guid)}");
     }
 }
Exemplo n.º 19
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <teResourceGUID, Hero> heroes = GetHeroes();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    OutputJSON(heroes, flags);
                    return;
                }
            }

            IndentHelper indentLevel = new IndentHelper();

            foreach (KeyValuePair <teResourceGUID, Hero> hero in heroes)
            {
                Log($"{hero.Value.Name}");
                if (!(toolFlags as ListFlags).Simplify)
                {
                    if (hero.Value.Description != null)
                    {
                        Log($"{indentLevel + 1}Description: {hero.Value.Description}");
                    }

                    Log($"{indentLevel + 1}Gender: {hero.Value.Gender}");

                    Log($"{indentLevel + 1}Size: {hero.Value.Size}");

                    TankLib.Helpers.Logger.Log24Bit(ConsoleColor.White.AsDOSColor().AsXTermColor().ToForeground(), null, false, Console.Out, null, $"{indentLevel + 1}Color: {hero.Value.GalleryColor.ToHex()} ");
                    TankLib.Helpers.Logger.Log24Bit(hero.Value.GalleryColor.ToForeground(), null, true, Console.Out, null, "██████");


                    TankLib.Helpers.Logger.Log24Bit(ConsoleColor.White.AsDOSColor().AsXTermColor().ToForeground(), null, false, Console.Out, null, $"{indentLevel + 1}sRGB Color: {hero.Value.GalleryColor.ToNonLinear().ToHex()} ");
                    TankLib.Helpers.Logger.Log24Bit(hero.Value.GalleryColor.ToNonLinear().ToForeground(), null, true, Console.Out, null, "██████");

                    if (hero.Value.Loadouts != null)
                    {
                        Log($"{indentLevel + 1}Loadouts:");
                        foreach (var loadout in hero.Value.Loadouts)
                        {
                            Log($"{indentLevel + 2}{loadout.Name}: {loadout.Category}");
                            Log($"{indentLevel + 3}{loadout.Description}");
                        }
                    }

                    Log();
                }
            }
        }
Exemplo n.º 20
0
        protected override void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            Log("Please specify what you want to extract:");
            Log($"{indent+1}Command format: \"{{map name}}\" ");
            Log($"{indent+1}Each query should be surrounded by \", and individual queries should be separated by spaces");


            Log($"{indent+1}Maps can be listed using the \"list-maps\" mode");
            Log($"{indent+1}All map names are in your selected locale");

            Log("\r\nExample commands: ");
            Log($"{indent+1}\"Kings Row\"");
            Log($"{indent+1}\"Ilios\" \"Oasis\"");
        }
Exemplo n.º 21
0
 private static void ParseGamemodeInfo(IndentHelper iD, STUGUID[] gamemodeInfo)
 {
     if (gamemodeInfo == null)
     {
         return;
     }
     Log($"{iD}Game Info:");
     foreach (var guid in gamemodeInfo)
     {
         var something = GetInstance <STUGamemodeBaseInfo>(guid);
         if (something != null)
         {
             Log($"{iD+1}{GetString(something.Name)}");
         }
     }
 }
Exemplo n.º 22
0
        protected override void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            Log("Please specify what you want to extract:");
            Log($"{indent + 1}Command format: \"{{hero name}}|{{type}}=({{tag name}}={{tag}}),{{item name}}\"");
            Log($"{indent + 1}Each query should be surrounded by \", and individual queries should be separated by spaces");

            Log($"{indent + 1}All hero names are in your selected locale");

            Log("\r\nExample commands: ");
            Log($"{indent + 1}\"Lúcio\"");
            Log($"{indent + 1}\"Torbjörn\"");
            Log($"{indent + 1}\"Moira\"");
            Log($"{indent + 1}\"Wrecking Ball\"");
        }
Exemplo n.º 23
0
 private static void ParseUnlocks(IndentHelper iD, STUGUID[] unlocks)
 {
     if (unlocks == null)
     {
         return;
     }
     Log($"{iD}Unlocks:");
     foreach (var guid in unlocks)
     {
         var unlock = GatherUnlock(guid) ?? GatherUnlock(GetInstance <STUAchievement>(guid)?.Reward);
         if (unlock != null)
         {
             Log($"{iD+1}{unlock.Name} ({unlock.Rarity} {unlock.Type})");
         }
     }
 }
Exemplo n.º 24
0
        protected override void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            Log("Please specify what you want to extract:");
            Log($"{indent+1}Command format: \"{{hero name}}|{{type}}=({{tag name}}={{tag}}),{{item name}}\"");
            Log($"{indent+1}Each query should be surrounded by \", and individual queries should be seperated by spaces");

            Log($"{indent+1}All hero and item names are in your selected locale");

            Log("\r\nTypes:");
            foreach (QueryType argType in types)
            {
                Log($"{indent+1}{argType.Name}");
            }

            Log("\r\nTags:");

            foreach (QueryType argType in types)
            {
                foreach (QueryTag argTypeTag in argType.Tags)
                {
                    Log($"{indent+1}{argTypeTag.Name}:");
                    foreach (string option in argTypeTag.Options)
                    {
                        Log($"{indent+2}{option}");
                    }
                }
                break;  // erm, ok
            }

            Log("\r\nExample commands: ");
            Log($"{indent+1}\"Lúcio|skin=common\"");
            Log($"{indent+1}\"Torbjörn|skin=(rarity=legendary)\"");
            Log($"{indent+1}\"D.Va|skin=(event=summergames)\"");
            Log($"{indent+1}\"Soldier: 76|skin=Daredevil: 76\" \"Roadhog|spray=Pixel\"");
            Log($"{indent+1}\"Reaper|spray=*\" \t(extract all of Reaper's sprays)");
            Log($"{indent+1}\"Reaper|spray=(event=!halloween)\" \t\t(extract all of Reper's sprays that are not from Halloween)");
            Log($"{indent+1}\"Reaper|skin=(rarity=legendary)\" \t\t(extract all of Reaper's legendary skins)");
            Log($"{indent+1}\"Reaper|spray=!Cute,*\" \t\t(extract all of Reaper's sprays except \"Cute\")");
            Log($"{indent+1}\"*|skin=(leagueteam=none)\" \t\t(extract skins for every hero ignoring Overwatch League skins)");

            // Log("https://www.youtube.com/watch?v=9Deg7VrpHbM");
        }
Exemplo n.º 25
0
        protected override void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            base.QueryHelp(types);

            Log("\r\nExample commands: ");
            Log($"{indent+1}\"Lúcio|skin=common\"");
            Log($"{indent+1}\"Torbjörn|skin=(rarity=legendary)\"");
            Log($"{indent+1}\"D.Va|skin=(event=summergames)\"");
            Log($"{indent+1}\"Soldier: 76|skin=Daredevil: 76\" \"Roadhog|spray=Pixel\"");
            Log($"{indent+1}\"Reaper|spray=*\" \t(extract all of Reaper's sprays)");
            Log($"{indent+1}\"Reaper|spray=(event=!halloween)\" \t\t(extract all of Reaper's sprays that are not from Halloween)");
            Log($"{indent+1}\"Reaper|skin=(rarity=legendary)\" \t\t(extract all of Reaper's legendary skins)");
            Log($"{indent+1}\"Reaper|spray=!Cute,*\" \t\t(extract all of Reaper's sprays except \"Cute\")");
            Log($"{indent+1}\"*|skin=(leagueteam=none)\" \t\t(extract skins for every hero ignoring Overwatch League skins)");

            // Log("https://www.youtube.com/watch?v=9Deg7VrpHbM");
        }
Exemplo n.º 26
0
        private ConfigLoadResult CombineFileConfigProviders()
        {
            var configBuilder = CreateAnalyzerConfigBuilder();

            var anyConfigFound = false;

            foreach (var childConfigProvider in Enumerable.Reverse(_fileConfigProviders))
            {
                var childConfigState = childConfigProvider.ConfigState;

                LogTraceMessage(IndentHelper.Indent($"Combining {childConfigProvider}, state={childConfigState}", 1));

                switch (childConfigState)
                {
                case AnalyzerConfigState.NoConfig:
                    break;

                case AnalyzerConfigState.Disabled:
                    anyConfigFound = true;
                    configBuilder.SetIsEnabled(false);
                    break;

                case AnalyzerConfigState.Enabled:
                    anyConfigFound = true;

                    var childConfigBuilder = childConfigProvider.ConfigBuilder;
                    configBuilder.Combine(childConfigBuilder);
                    LogTraceMessage(IndentHelper.Indent(childConfigBuilder.ToStrings(), 2));
                    break;

                case AnalyzerConfigState.ConfigError:
                    return(ConfigLoadResult.CreateWithError(childConfigProvider.ConfigException));

                default:
                    throw new ArgumentOutOfRangeException(nameof(childConfigState), childConfigState, "Unexpected value.");
                }
            }

            return(anyConfigFound
                ? ConfigLoadResult.CreateWithConfig(configBuilder)
                : ConfigLoadResult.CreateWithNoConfig());
        }
Exemplo n.º 27
0
        protected virtual void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            Log("Error parsing query:");
            Log($"{indent + 1}Command format: \"{{hero name}}|{{type}}=({{tag name}}={{tag}}),{{item name}}\"");
            Log($"{indent + 1}Each query should be surrounded by \", and individual queries should be separated by spaces");
            Log($"{indent + 1}All hero and item names are in your selected locale");

            Log("\r\nTypes:");
            foreach (QueryType argType in types)
            {
                Log($"{indent + 1}{argType.Name}");
            }

            Log("\r\nTags:");

            foreach (QueryType argType in types)
            {
                if (argType.Tags == null)
                {
                    continue;
                }
                foreach (QueryTag argTypeTag in argType.Tags)
                {
                    LogSL($"{indent + 1}{argTypeTag.Name}:");
                    if (argTypeTag.Default != null)
                    {
                        TankLib.Helpers.Logger.Log24Bit(ConsoleSwatch.XTermColor.Wheat, false, Console.Out, null, $" \"{argTypeTag.Default}\"");
                    }

                    Log();
                    foreach (string option in argTypeTag.Options)
                    {
                        Log($"{indent + 2}{option}");
                    }
                }

                break; // erm, ok
            }
        }
Exemplo n.º 28
0
        public void Parse(ICLIFlags toolFlags)
        {
            var data = GetData();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    OutputJSON(data, flags);
                    return;
                }
            }

            var i = new IndentHelper();

            foreach (var item in data)
            {
                Log($"{item.Key}");
                Log($"{i + 1}{item.Value}");
            }
        }
Exemplo n.º 29
0
        protected override void QueryHelp(List <QueryType> types)
        {
            IndentHelper indent = new IndentHelper();

            Log("Please specify what you want to extract:");
            Log($"{indent + 1}Command format: \"{{hero name}}|{{type}}=({{tag name}}={{tag}}),{{item name}}\"");
            Log($"{indent + 1}Each query should be surrounded by \", and individual queries should be seperated by spaces");

            Log($"{indent + 1}All hero names are in your selected locale");

            Log("\r\nTypes:");
            foreach (QueryType argType in types)
            {
                Log($"{indent + 1}{argType.Name}");
            }

            Log("\r\nExample commands: ");
            Log($"{indent + 1}\"Lúcio|soundRestriction=00000000B56B.0B2\"");
            Log($"{indent + 1}\"Torbjörn|groupRestriction=0000000000CD.078\"");
            Log($"{indent + 1}\"Moira\"");
        }
Exemplo n.º 30
0
        public void Parse(ICLIFlags toolFlags)
        {
            Dictionary <string, Hero> heroes = GetHeroes();

            if (toolFlags is ListFlags flags)
            {
                if (flags.JSON)
                {
                    ParseJSON(heroes, flags);
                    return;
                }
            }

            IndentHelper indentLevel = new IndentHelper();

            foreach (KeyValuePair <string, Hero> hero in heroes)
            {
                Log($"{hero.Value.Name}");
                if (hero.Value.Description != null)
                {
                    Log($"{indentLevel + 1}Description: {hero.Value.Description}");
                }

                TankLib.Helpers.Logger.Log24Bit(ConsoleSwatch.ColorReset, null, false, null, $"{indentLevel + 1}Color: {hero.Value.GalleryColor.ToHex()} ");
                TankLib.Helpers.Logger.Log24Bit(hero.Value.GalleryColor.ToForeground(), null, true, null, "██████");

                if (hero.Value.Loadouts != null)
                {
                    Log($"{indentLevel + 1}Loadouts:");
                    foreach (Loadout loadout in hero.Value.Loadouts)
                    {
                        Log($"{indentLevel + 2}{loadout.Name}: {loadout.Category}");
                        Log($"{indentLevel + 3}{loadout.Description}");
                    }
                }

                Log();
            }
        }