private static void ReadFilterTags(string tagsToAdd, FMCategoriesCollection existingTags) { if (tagsToAdd.IsWhiteSpace()) { return; } // We need slightly different logic for this vs. the FM tag adder, to wit, we support tags of the // form "category:" (with no tags list). This is because we allow filtering by entire category, // whereas we don't allow FMs to have categories with no tags in them. string[] tagsArray = tagsToAdd.Split(CA_CommaSemicolon, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < tagsArray.Length; i++) { if (!FMTags.TryGetCatAndTag(tagsArray[i], out string cat, out string tag) || cat.IsEmpty()) { continue; } if (existingTags.TryGetValue(cat, out FMTagsCollection tagsList)) { if (!tag.IsEmpty()) { tagsList.Add(tag); } } else { var newTagsList = new FMTagsCollection(); if (!tag.IsEmpty()) { newTagsList.Add(tag); } existingTags.Add(cat, newTagsList); } } }
private static string TagsToString(FMCategoriesCollection tagsList) { return(FMTags.TagsToString(tagsList, writeEmptyCategories: true)); }