Skip to content

Commit

Permalink
Add Tag validation case sensitivity option
Browse files Browse the repository at this point in the history
  • Loading branch information
t0815 committed Oct 30, 2023
1 parent 95e6f49 commit c4d0941
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 41 deletions.
5 changes: 4 additions & 1 deletion MyCBZ/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<setting name="CompatMode" serializeAs="String">
<value>False</value>
</setting>
<setting name="TagValidationIgnoreCase" serializeAs="String">
<value>False</value>
</setting>
</Win_CBZ.Win_CBZSettings>
<Win_CBZ.CBZMageSettings>
<setting name="TempFolderPath" serializeAs="String">
Expand All @@ -61,7 +64,7 @@
<applicationSettings>
<Win_CBZ.Win_CBZSettings>
<setting name="Version" serializeAs="String">
<value>0.14.69b</value>
<value>0.14.70b</value>
</setting>
<setting name="RenamerPlaceholders" serializeAs="Xml">
<value>
Expand Down
31 changes: 28 additions & 3 deletions MyCBZ/Data/DataValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,46 @@ public static bool ValidateTags(ref ArrayList unknownTagsList, bool showError =

MetaDataEntry tagEntry = Program.ProjectModel.MetaData.EntryByKey("Tags");
System.Collections.Specialized.StringCollection validTags = Win_CBZSettings.Default.ValidKnownTags;
System.Collections.Specialized.StringCollection validTagsLcase = new System.Collections.Specialized.StringCollection();
//ArrayList unknownTags = new ArrayList();

if (unknownTagsList == null)
{
unknownTagsList = new ArrayList();
}

if (Win_CBZSettings.Default.TagValidationIgnoreCase) {
String[] bufferStrings = new string[validTags.Count];
validTags.CopyTo(bufferStrings, 0);
validTagsLcase.AddRange(bufferStrings.Select(s => s.ToLower()).ToArray());
}

if (tagEntry != null && tagEntry.Value != null && tagEntry.Value.Length > 0 && validTags.Count > 0)
{
String[] tags = tagEntry.Value.Split(',').Select(s => s.Trim()).ToArray();
String[] tags = new String[1];
if (Win_CBZSettings.Default.TagValidationIgnoreCase)
{
tags = tagEntry.Value.Split(',').Select(s => s.Trim().ToLower()).ToArray();
} else
{
tags = tagEntry.Value.Split(',').Select(s => s.Trim()).ToArray();
}

foreach (String tag in tags)
{
if (!validTags.Contains(tag))
if (Win_CBZSettings.Default.TagValidationIgnoreCase)
{
if (!validTagsLcase.Contains(tag.ToLower()))
{
unknownTagsList.Add(tag);
}
}
else
{
unknownTagsList.Add(tag);
if (!validTags.Contains(tag))
{
unknownTagsList.Add(tag);
}
}
}
}
Expand Down
28 changes: 14 additions & 14 deletions MyCBZ/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions MyCBZ/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,7 @@ private void SettingsToolStripMenuItem_Click(object sender, EventArgs e)
}

Win_CBZSettings.Default.ValidateTags = settingsDialog.ValidateTagsSetting;
Win_CBZSettings.Default.TagValidationIgnoreCase = settingsDialog.TagValidationIgnoreCase;
}
}

Expand Down
8 changes: 4 additions & 4 deletions MyCBZ/Forms/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABu
CgAAAk1TRnQBSQFMAgEBAwEAAcgBDgHIAQ4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CgAAAk1TRnQBSQFMAgEBAwEAAdABDgHQAQ4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -198,7 +198,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABe
PgAAAk1TRnQBSQFMAgEBEQEAAcgBDgHIAQ4BGAEAARgBAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFg
PgAAAk1TRnQBSQFMAgEBEQEAAdABDgHQAQ4BGAEAARgBAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFg
AwABeAMAAQEBAAEYBgABh/8A/wD/AHgAAtQB1QMnNiUDJwPV3gADvQMlNr0DJQO+3gADvQMlEgAD/wHl
AfMB9gG8AeoB8wG8AeoB8wHlAfMB9gP/EgADJQO+3gADvQMlDwAB9AH4AfkBUAHaAfQBAAHSAfoBAAHS
AfoBAAHSAfoBAAHSAfoBUAHaAvQB+AH5DwADJQO+3gADvQMlDAAB+gL7AS4B1wH3AQAB0gH6AcwB7QL0
Expand Down Expand Up @@ -490,7 +490,7 @@ The Page with Type 'FrontCover' should be at index 1.
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb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A0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
Loading

0 comments on commit c4d0941

Please sign in to comment.