private static bool RemoveTagFromFM(FanMission fm, string catText, string tagText, bool isCategory) { // Parent node (category) if (isCategory) { if (catText.IsWhiteSpace()) { return(false); } // TODO: These messageboxes are annoying, but they prevent accidental deletion. // Figure out something better. bool cont = Dialogs.AskToContinue(LText.TagsTab.AskRemoveCategory, LText.TagsTab.TabText, true); if (!cont) { return(false); } if (fm.Tags.ContainsKey(catText)) { fm.Tags.Remove(catText); UpdateFMTagsString(fm); } } // Child node (tag) else { if (tagText.IsWhiteSpace()) { return(false); } bool cont = Dialogs.AskToContinue(LText.TagsTab.AskRemoveTag, LText.TagsTab.TabText, true); if (!cont) { return(false); } if (fm.Tags.TryGetValue(catText, out FMTagsCollection tagsList) && tagsList.Contains(tagText)) { tagsList.Remove(tagText); if (tagsList.Count == 0) { fm.Tags.Remove(catText); } UpdateFMTagsString(fm); } } RebuildGlobalTags(); Ini.WriteFullFMDataIni(); return(true); }