////////////////

        private void FilterModsAsync(UIState _menuUi, IList <string> modNames, FilteredModsHandler callback)
        {
            CustomLoadHooks.AddHook(GetModTags.TagsReceivedHookValidator, (args) => {
                if (!args.Found)
                {
                    this.SetInfoText("Could not acquire mod data.");
                    callback(_menuUi, false, new List <string>(), 0, 0);
                    return(false);
                }

                this.FilterMods(_menuUi, modNames, args.ModTags, callback);
                return(false);
            });
        }
        private void FilterMods(UIState _menuUi,
                                IList <string> modNames,
                                IDictionary <string, ISet <string> > modTagsOfModNames,
                                FilteredModsHandler callback)
        {
            IList <string> filteredModNameList = new List <string>();
            ISet <string>  onTags     = this.GetTagsWithGivenState(1);
            ISet <string>  offTags    = this.GetTagsWithGivenState(-1);
            bool           isFiltered = onTags.Count > 0 || offTags.Count > 0;

            if (isFiltered)
            {
                foreach (string modName in modNames)
                {
                    if (modTagsOfModNames.ContainsKey(modName))
                    {
                        ISet <string> myModsTags = modTagsOfModNames[modName];

                        if (myModsTags.Overlaps(offTags))
                        {
                            continue;
                        }
                        if (onTags.Count > 0 && !myModsTags.IsSupersetOf(onTags))
                        {
                            continue;
                        }
                    }
                    else if (onTags.Count > 0)
                    {
                        continue;
                    }

                    filteredModNameList.Add(modName);
                }
            }

            if (ModHelpersMod.Config.DebugModeHelpersInfo)
            {
                LogHelpers.Log("Filtered to " + filteredModNameList.Count + " mods."
                               + (onTags.Count > 0 ? "\nWith tags: " + string.Join(", ", onTags) : "")
                               + (offTags.Count > 0 ? "\nWithout tags: " + string.Join(", ", offTags) : "")
                               );
            }

            callback(_menuUi, isFiltered, filteredModNameList, onTags.Count, offTags.Count);
        }