diff --git a/.gitignore b/.gitignore
index 1b93d41..a605cdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -262,8 +262,3 @@ __pycache__/
# JetBrains Rider IDE
.idea/
-/AnitomySharpTests/Resource.resx
-/AnitomySharpTests/Resource.Designer.cs
-/AnitomySharpTests/AnitomySharpTests.csproj
-/AnitomySharp.sln
-/AnitomySharp/AnitomySharp.csproj
diff --git a/AnitomySharp.sln b/AnitomySharp.sln
new file mode 100644
index 0000000..418b2d0
--- /dev/null
+++ b/AnitomySharp.sln
@@ -0,0 +1,37 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33829.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnitomySharp", "AnitomySharp\AnitomySharp.csproj", "{1240372C-C46B-4604-BB75-EFFC393549F7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnitomySharpTests", "AnitomySharpTests\AnitomySharpTests.csproj", "{06FF06C1-C5E3-4C2D-A6AE-CDB4C8068527}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnitomySharpUI", "AnitomySharpUI\AnitomySharpUI.csproj", "{5AF3F53E-3F8B-410C-B6C3-61818ECEBC0C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1240372C-C46B-4604-BB75-EFFC393549F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1240372C-C46B-4604-BB75-EFFC393549F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1240372C-C46B-4604-BB75-EFFC393549F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1240372C-C46B-4604-BB75-EFFC393549F7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {06FF06C1-C5E3-4C2D-A6AE-CDB4C8068527}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {06FF06C1-C5E3-4C2D-A6AE-CDB4C8068527}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {06FF06C1-C5E3-4C2D-A6AE-CDB4C8068527}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {06FF06C1-C5E3-4C2D-A6AE-CDB4C8068527}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5AF3F53E-3F8B-410C-B6C3-61818ECEBC0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5AF3F53E-3F8B-410C-B6C3-61818ECEBC0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5AF3F53E-3F8B-410C-B6C3-61818ECEBC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5AF3F53E-3F8B-410C-B6C3-61818ECEBC0C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {06FDC297-490E-43DF-AD8A-C182493C21AF}
+ EndGlobalSection
+EndGlobal
diff --git a/AnitomySharp/Anitomy.cs b/AnitomySharp/Anitomy.cs
index 7791ef7..ba74098 100644
--- a/AnitomySharp/Anitomy.cs
+++ b/AnitomySharp/Anitomy.cs
@@ -13,7 +13,6 @@
namespace AnitomySharp
{
-
///
/// A library capable of parsing Anime filenames
/// This code is a C++ to C# port of Anitomy>,
@@ -21,7 +20,7 @@ namespace AnitomySharp
///
public class AnitomySharp
{
- private AnitomySharp() {}
+ private AnitomySharp() { }
///
/// Parses an anime into its constituent elements.
diff --git a/AnitomySharp/AnitomySharp.csproj b/AnitomySharp/AnitomySharp.csproj
new file mode 100644
index 0000000..5ca1a0f
--- /dev/null
+++ b/AnitomySharp/AnitomySharp.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Library
+ net7.0
+ enable
+ enable
+
+
+
diff --git a/AnitomySharp/Element.cs b/AnitomySharp/Element.cs
index 0ffec70..97aecb3 100644
--- a/AnitomySharp/Element.cs
+++ b/AnitomySharp/Element.cs
@@ -10,11 +10,11 @@
namespace AnitomySharp
{
- ///
- /// An represents an identified Anime .
- /// A single filename may contain multiple of the same
- /// token(e.g ).
- ///
+ ///
+ /// An represents an identified Anime .
+ /// A single filename may contain multiple of the same
+ /// token(e.g ).
+ ///
public class Element
{
/** Element Categories */
diff --git a/AnitomySharp/Keyword.cs b/AnitomySharp/Keyword.cs
index 4615b4c..c39d320 100644
--- a/AnitomySharp/Keyword.cs
+++ b/AnitomySharp/Keyword.cs
@@ -14,7 +14,6 @@
namespace AnitomySharp
{
-
///
/// A class to manager the list of known anime keywords. This class is analogous to keyword.cpp of Anitomy, and KeywordManager.java of AnitomyJ
///
@@ -32,23 +31,23 @@ static KeywordManager()
var optionsUnidentifiableInvalid = new KeywordOptions(false, true, false);
var optionsUnidentifiableUnsearchable = new KeywordOptions(false, false, true);
- Add(Element.ElementCategory.ElementAnimeSeasonPrefix,
+ Add(Element.ElementCategory.ElementAnimeSeasonPrefix,
optionsUnidentifiable,
- new List {"SAISON", "SEASON"});
-
+ new List { "SAISON", "SEASON" });
+
Add(Element.ElementCategory.ElementAnimeType,
optionsUnidentifiable,
- new List {"GEKIJOUBAN", "MOVIE", "OAD", "OAV", "ONA", "OVA", "SPECIAL", "SPECIALS", "TV"});
+ new List { "GEKIJOUBAN", "MOVIE", "OAD", "OAV", "ONA", "OVA", "SPECIAL", "SPECIALS", "TV" });
Add(Element.ElementCategory.ElementAnimeType,
optionsUnidentifiableUnsearchable,
- new List {"SP"}); // e.g. "Yumeiro Patissiere SP Professional"
+ new List { "SP" }); // e.g. "Yumeiro Patissiere SP Professional"
Add(Element.ElementCategory.ElementAnimeType,
optionsUnidentifiableInvalid,
- new List {"ED", "ENDING", "NCED", "NCOP", "OP", "OPENING", "PREVIEW", "PV"});
+ new List { "ED", "ENDING", "NCED", "NCOP", "OP", "OPENING", "PREVIEW", "PV" });
- Add(Element.ElementCategory.ElementAudioTerm,
+ Add(Element.ElementCategory.ElementAudioTerm,
optionsDefault,
new List {
// Audio channels
@@ -63,63 +62,63 @@ static KeywordManager()
Add(Element.ElementCategory.ElementDeviceCompatibility,
optionsDefault,
- new List {"IPAD3", "IPHONE5", "IPOD", "PS3", "XBOX", "XBOX360"});
+ new List { "IPAD3", "IPHONE5", "IPOD", "PS3", "XBOX", "XBOX360" });
Add(Element.ElementCategory.ElementDeviceCompatibility,
optionsUnidentifiable,
- new List {"ANDROID"});
+ new List { "ANDROID" });
Add(Element.ElementCategory.ElementEpisodePrefix,
optionsDefault,
- new List {"EP", "EP.", "EPS", "EPS.", "EPISODE", "EPISODE.", "EPISODES", "CAPITULO", "EPISODIO", "FOLGE"});
+ new List { "EP", "EP.", "EPS", "EPS.", "EPISODE", "EPISODE.", "EPISODES", "CAPITULO", "EPISODIO", "EPIS\u00F3DIO", "FOLGE" });
Add(Element.ElementCategory.ElementEpisodePrefix,
optionsInvalid,
- new List {"E", "\\x7B2C"}); // single-letter episode keywords are not valid tokens
+ new List { "E", "\\x7B2C" }); // single-letter episode keywords are not valid tokens
Add(Element.ElementCategory.ElementFileExtension,
optionsDefault,
- new List {"3GP", "AVI", "DIVX", "FLV", "M2TS", "MKV", "MOV", "MP4", "MPG", "OGM", "RM", "RMVB", "TS", "WEBM", "WMV"});
+ new List { "3GP", "AVI", "DIVX", "FLV", "M2TS", "MKV", "MOV", "MP4", "MPG", "OGM", "RM", "RMVB", "TS", "WEBM", "WMV" });
Add(Element.ElementCategory.ElementFileExtension,
optionsInvalid,
- new List {"AAC", "AIFF", "FLAC", "M4A", "MP3", "MKA", "OGG", "WAV", "WMA", "7Z", "RAR", "ZIP", "ASS", "SRT"});
+ new List { "AAC", "AIFF", "FLAC", "M4A", "MP3", "MKA", "OGG", "WAV", "WMA", "7Z", "RAR", "ZIP", "ASS", "SRT" });
Add(Element.ElementCategory.ElementLanguage,
optionsDefault,
- new List {"ENG", "ENGLISH", "ESPANO", "JAP", "PT-BR", "SPANISH", "VOSTFR"});
+ new List { "ENG", "ENGLISH", "ESPANO", "JAP", "PT-BR", "SPANISH", "VOSTFR" });
Add(Element.ElementCategory.ElementLanguage,
optionsUnidentifiable,
- new List {"ESP", "ITA"}); // e.g. "Tokyo ESP:, "Bokura ga Ita"
+ new List { "ESP", "ITA" }); // e.g. "Tokyo ESP:, "Bokura ga Ita"
Add(Element.ElementCategory.ElementOther,
optionsDefault,
- new List {"REMASTER", "REMASTERED", "UNCENSORED", "UNCUT", "TS", "VFR", "WIDESCREEN", "WS"});
+ new List { "REMASTER", "REMASTERED", "UNCENSORED", "UNCUT", "TS", "VFR", "WIDESCREEN", "WS" });
Add(Element.ElementCategory.ElementReleaseGroup,
optionsDefault,
- new List {"THORA"});
+ new List { "THORA" });
Add(Element.ElementCategory.ElementReleaseInformation,
optionsDefault,
- new List {"BATCH", "COMPLETE", "PATCH", "REMUX"});
+ new List { "BATCH", "COMPLETE", "PATCH", "REMUX" });
Add(Element.ElementCategory.ElementReleaseInformation,
optionsUnidentifiable,
- new List {"END", "FINAL"}); // e.g. "The End of Evangelion", 'Final Approach"
+ new List { "END", "FINAL" }); // e.g. "The End of Evangelion", 'Final Approach"
Add(Element.ElementCategory.ElementReleaseVersion,
optionsDefault,
- new List {"V0", "V1", "V2", "V3", "V4"});
+ new List { "V0", "V1", "V2", "V3", "V4" });
Add(Element.ElementCategory.ElementSource,
optionsDefault,
- new List {"BD", "BDRIP", "BLURAY", "BLU-RAY", "DVD", "DVD5", "DVD9", "DVD-R2J", "DVDRIP", "DVD-RIP", "R2DVD", "R2J", "R2JDVD", "R2JDVDRIP", "HDTV", "HDTVRIP", "TVRIP", "TV-RIP", "WEBCAST", "WEBRIP"});
+ new List { "BD", "BDRIP", "BLURAY", "BLU-RAY", "DVD", "DVD5", "DVD9", "DVD-R2J", "DVDRIP", "DVD-RIP", "R2DVD", "R2J", "R2JDVD", "R2JDVDRIP", "HDTV", "HDTVRIP", "TVRIP", "TV-RIP", "WEBCAST", "WEBRIP" });
Add(Element.ElementCategory.ElementSubtitles,
optionsDefault,
- new List {"ASS", "BIG5", "DUB", "DUBBED", "HARDSUB", "HARDSUBS", "RAW", "SOFTSUB", "SOFTSUBS", "SUB", "SUBBED", "SUBTITLED"});
+ new List { "ASS", "BIG5", "DUB", "DUBBED", "HARDSUB", "HARDSUBS", "RAW", "SOFTSUB", "SOFTSUBS", "SUB", "SUBBED", "SUBTITLED" });
Add(Element.ElementCategory.ElementVideoTerm,
optionsDefault,
@@ -131,6 +130,7 @@ static KeywordManager()
"HI10", "HI10P", "HI444", "HI444P", "HI444PP",
"H264", "H265", "H.264", "H.265", "X264", "X265", "X.264",
"AVC", "HEVC", "HEVC2", "DIVX", "DIVX5", "DIVX6", "XVID",
+ "AV1",
// Video format
"AVI", "RMVB", "WMV", "WMV3", "WMV9",
// Video quality
@@ -140,7 +140,7 @@ static KeywordManager()
Add(Element.ElementCategory.ElementVolumePrefix,
optionsDefault,
- new List {"VOL", "VOL.", "VOLUME"});
+ new List { "VOL", "VOL.", "VOLUME" });
PeekEntries = new List>>
{
@@ -181,11 +181,11 @@ public static bool FindAndSet(string keyword, ref Element.ElementCategory catego
{
return false;
}
-
+
if (category == Element.ElementCategory.ElementUnknown)
{
category = foundEntry.Category;
- }
+ }
else if (foundEntry.Category != category)
{
return false;
@@ -246,7 +246,7 @@ public class KeywordOptions
public bool Searchable { get; }
public bool Valid { get; }
- public KeywordOptions() : this(true, true, true) {}
+ public KeywordOptions() : this(true, true, true) { }
///
/// Constructs a new keyword options
diff --git a/AnitomySharp/Parser.cs b/AnitomySharp/Parser.cs
index adfdac8..53eaf45 100644
--- a/AnitomySharp/Parser.cs
+++ b/AnitomySharp/Parser.cs
@@ -112,7 +112,8 @@ private void SearchForKeywords()
if (Empty(Element.ElementCategory.ElementFileChecksum) && ParserHelper.IsCrc32(word))
{
category = Element.ElementCategory.ElementFileChecksum;
- } else if (Empty(Element.ElementCategory.ElementVideoResolution) && ParserHelper.IsResolution(word))
+ }
+ else if (Empty(Element.ElementCategory.ElementVideoResolution) && ParserHelper.IsResolution(word))
{
category = Element.ElementCategory.ElementVideoResolution;
}
diff --git a/AnitomySharp/ParserHelper.cs b/AnitomySharp/ParserHelper.cs
index f2cb511..5cf5a38 100644
--- a/AnitomySharp/ParserHelper.cs
+++ b/AnitomySharp/ParserHelper.cs
@@ -15,7 +15,6 @@
namespace AnitomySharp
{
-
///
/// Utility class to assist in the parsing.
///
@@ -156,7 +155,8 @@ public bool IsElementCategorySearchable(Element.ElementCategory category)
///
public bool IsElementCategorySingular(Element.ElementCategory category)
{
- switch (category) {
+ switch (category)
+ {
case Element.ElementCategory.ElementAnimeSeason:
case Element.ElementCategory.ElementAnimeType:
case Element.ElementCategory.ElementAudioTerm:
@@ -275,18 +275,18 @@ public void BuildElement(Element.ElementCategory category, bool keepDelimiters,
if (keepDelimiters)
{
element.Append(delimiter);
- }
+ }
else if (Token.InListRange(i, tokens))
{
switch (delimiter)
{
- case ",":
- case "&":
- element.Append(delimiter);
- break;
- default:
- element.Append(' ');
- break;
+ case ",":
+ case "&":
+ element.Append(delimiter);
+ break;
+ default:
+ element.Append(' ');
+ break;
}
}
break;
diff --git a/AnitomySharp/ParserNumber.cs b/AnitomySharp/ParserNumber.cs
index 060abcd..955b2ce 100644
--- a/AnitomySharp/ParserNumber.cs
+++ b/AnitomySharp/ParserNumber.cs
@@ -15,7 +15,6 @@
namespace AnitomySharp
{
-
///
/// A utility class to assist in number parsing.
///
@@ -109,7 +108,7 @@ public bool SetEpisodeNumber(string number, Token token, bool validate)
if (comparison > 0)
{
category = Element.ElementCategory.ElementEpisodeNumberAlt;
- }
+ }
else if (comparison < 0)
{
element.Category = Element.ElementCategory.ElementEpisodeNumberAlt;
@@ -175,7 +174,7 @@ private bool NumberComesBeforeAnotherNumber(Token token, int currentTokenIdx)
Tuple.Create("&", true),
Tuple.Create("of", false)
};
-
+
foreach (var separator in separators)
{
if (_parser.Tokens[separatorToken].Content != separator.Item1) continue;
@@ -260,7 +259,7 @@ public bool MatchEpisodePatterns(string word, Token token)
{
return true;
}
-
+
// U+8A71 is used as counter for stories, episodes of TV series, etc.
return numericFront && MatchJapaneseCounterPattern(word, token);
}
@@ -273,11 +272,11 @@ public bool MatchEpisodePatterns(string word, Token token)
/// true if the token matched
private bool MatchSingleEpisodePattern(string word, Token token)
{
- const string regexPattern = RegexMatchOnlyStart + @"(\d{1,3})[vV](\d)" + RegexMatchOnlyEnd;
+ const string regexPattern = RegexMatchOnlyStart + @"(\d{1,4})[vV](\d)" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
-
+
SetEpisodeNumber(match.Groups[1].Value, token, false);
_parser.Elements.Add(new Element(Element.ElementCategory.ElementReleaseVersion, match.Groups[2].Value));
return true;
@@ -291,10 +290,10 @@ private bool MatchSingleEpisodePattern(string word, Token token)
/// true if the token matched
private bool MatchMultiEpisodePattern(string word, Token token)
{
- const string regexPattern = RegexMatchOnlyStart + @"(\d{1,3})(?:[vV](\d))?[-~&+](\d{1,3})(?:[vV](\d))?" + RegexMatchOnlyEnd;
+ const string regexPattern = RegexMatchOnlyStart + @"(\d{1,4})(?:[vV](\d))?[-~&+](\d{1,4})(?:[vV](\d))?" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
-
+
var lowerBound = match.Groups[1].Value;
var upperBound = match.Groups[3].Value;
@@ -322,10 +321,11 @@ private bool MatchMultiEpisodePattern(string word, Token token)
/// true if the token matched
private bool MatchSeasonAndEpisodePattern(string word, Token token)
{
- const string regexPattern = RegexMatchOnlyStart + @"S?(\d{1,2})(?:-S?(\d{1,2}))?(?:x|[ ._-x]?E)(\d{1,3})(?:-E?(\d{1,3}))?" + RegexMatchOnlyEnd;
+ const string regexPattern = RegexMatchOnlyStart + @"S?(\d{1,2})(?:-S?(\d{1,2}))?(?:x|[ ._-x]?E)(\d{1,4})(?:-E?(\d{1,4}))?(?:[vV](\d))?" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
-
+ if (StringHelper.StringToInt(match.Groups[1].Value) == 0) return false;
+
_parser.Elements.Add(new Element(Element.ElementCategory.ElementAnimeSeason, match.Groups[1].Value));
if (!string.IsNullOrEmpty(match.Groups[2].Value))
{
@@ -336,6 +336,11 @@ private bool MatchSeasonAndEpisodePattern(string word, Token token)
{
SetEpisodeNumber(match.Groups[4].Value, token, false);
}
+ //Note: Below is not in Anitomy, but is required to pass the added test case. Possibly a bug.
+ if (!string.IsNullOrEmpty(match.Groups[5].Value))
+ {
+ _parser.Elements.Add(new Element(Element.ElementCategory.ElementReleaseVersion, match.Groups[5].Value));
+ }
return true;
}
@@ -360,7 +365,7 @@ private bool MatchTypeAndEpisodePattern(string word, Token token)
var foundIdx = _parser.Tokens.IndexOf(token);
if (foundIdx == -1) return true;
token.Content = number;
- _parser.Tokens.Insert(foundIdx,
+ _parser.Tokens.Insert(foundIdx,
new Token(options.Identifiable ? Token.TokenCategory.Identifier : Token.TokenCategory.Unknown, prefix, token.Enclosed));
return true;
@@ -413,7 +418,7 @@ private bool MatchPartialEpisodePattern(string word, Token token)
private bool MatchNumberSignPattern(string word, Token token)
{
if (string.IsNullOrEmpty(word) || word[0] != '#') word = "";
- const string regexPattern = RegexMatchOnlyStart + @"#(\d{1,3})(?:[-~&+](\d{1,3}))?(?:[vV](\d))?" + RegexMatchOnlyEnd;
+ const string regexPattern = RegexMatchOnlyStart + @"#(\d{1,4})(?:[-~&+](\d{1,4}))?(?:[vV](\d))?" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
@@ -440,7 +445,7 @@ private bool MatchNumberSignPattern(string word, Token token)
private bool MatchJapaneseCounterPattern(string word, Token token)
{
if (string.IsNullOrEmpty(word) || word[word.Length - 1] != '\u8A71') return false;
- const string regexPattern = RegexMatchOnlyStart + @"(\d{1,3})話" + RegexMatchOnlyEnd;
+ const string regexPattern = RegexMatchOnlyStart + @"(\d{1,4})話" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
SetEpisodeNumber(match.Groups[1].Value, token, false);
@@ -487,7 +492,7 @@ private bool MatchSingleVolumePattern(string word, Token token)
const string regexPattern = RegexMatchOnlyStart + @"(\d{1,2})[vV](\d)" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
-
+
SetVolumeNumber(match.Groups[1].Value, token, false);
_parser.Elements.Add(new Element(Element.ElementCategory.ElementReleaseVersion, match.Groups[2].Value));
return true;
@@ -505,7 +510,7 @@ private bool MatchMultiVolumePattern(string word, Token token)
const string regexPattern = RegexMatchOnlyStart + @"(\d{1,2})[-~&+](\d{1,2})(?:[vV](\d))?" + RegexMatchOnlyEnd;
var match = Regex.Match(word, regexPattern);
if (!match.Success) return false;
-
+
var lowerBound = match.Groups[1].Value;
var upperBound = match.Groups[2].Value;
if (StringHelper.StringToInt(lowerBound) >= StringHelper.StringToInt(upperBound)) return false;
@@ -667,7 +672,7 @@ public bool SearchForLastNumber(List tokens)
var previousToken = Token.FindPrevToken(_parser.Tokens, it, Token.TokenFlag.FlagNotDelimiter);
if (_parser.ParseHelper.IsTokenCategory(previousToken, Token.TokenCategory.Unknown))
{
- if (_parser.Tokens[previousToken].Content.Equals("Movie", StringComparison.InvariantCultureIgnoreCase)
+ if (_parser.Tokens[previousToken].Content.Equals("Movie", StringComparison.InvariantCultureIgnoreCase)
|| _parser.Tokens[previousToken].Content.Equals("Part", StringComparison.InvariantCultureIgnoreCase))
{
continue;
@@ -684,4 +689,4 @@ public bool SearchForLastNumber(List tokens)
return false;
}
}
-}
+}
diff --git a/AnitomySharp/StringHelper.cs b/AnitomySharp/StringHelper.cs
index 4e05e88..3d89f2f 100644
--- a/AnitomySharp/StringHelper.cs
+++ b/AnitomySharp/StringHelper.cs
@@ -13,7 +13,6 @@
namespace AnitomySharp
{
-
///
/// A string helper class that is analogous to string.cpp of the original Anitomy, and StringHelper.java of AnitomyJ.
///
@@ -93,4 +92,4 @@ public static string SubstringWithCheck(string str, int start, int count)
return str.Substring(start, count);
}
}
-}
+}
diff --git a/AnitomySharp/Token.cs b/AnitomySharp/Token.cs
index 61b2a17..5789793 100644
--- a/AnitomySharp/Token.cs
+++ b/AnitomySharp/Token.cs
@@ -14,7 +14,6 @@
namespace AnitomySharp
{
-
///
/// An anime filename is tokenized into individual s. This class represents an individual token.
///
@@ -164,7 +163,7 @@ public static int FindPrevToken(List tokens, int begin, params TokenFlag[
{
return FindTokenBase(tokens, begin - 1, -1, i => i >= 0, i => i - 1, flags);
}
-
+
///
/// Given a list of tokens finds the first token that passes .
///
diff --git a/AnitomySharp/TokenRange.cs b/AnitomySharp/TokenRange.cs
index 58c4153..1beea35 100644
--- a/AnitomySharp/TokenRange.cs
+++ b/AnitomySharp/TokenRange.cs
@@ -10,15 +10,15 @@
namespace AnitomySharp
{
- public struct TokenRange
- {
- public int Offset;
- public int Size;
+ public struct TokenRange
+ {
+ public int Offset;
+ public int Size;
- public TokenRange(int offset, int size)
- {
- Offset = offset;
- Size = size;
- }
+ public TokenRange(int offset, int size)
+ {
+ Offset = offset;
+ Size = size;
}
+ }
}
diff --git a/AnitomySharp/Tokenizer.cs b/AnitomySharp/Tokenizer.cs
index 27a7631..ee0d15c 100644
--- a/AnitomySharp/Tokenizer.cs
+++ b/AnitomySharp/Tokenizer.cs
@@ -113,7 +113,7 @@ int FindFirstBracket(int start, int end)
}
var isBracketOpen = false;
- for (var i = 0; i < _filename.Length; )
+ for (var i = 0; i < _filename.Length;)
{
var foundIdx = !isBracketOpen ? FindFirstBracket(i, _filename.Length) : _filename.IndexOf(matchingBracket, i, StringComparison.Ordinal);
@@ -306,7 +306,7 @@ void AppendTokenTo(Token src, Token dest)
token.Category = Token.TokenCategory.Unknown; // e.g. "& in "_&_"
}
}
-
+
// Check for other special cases
if (delimiter != '&' && delimiter != '+') continue;
if (!IsUnknownToken(prevToken) || !IsUnknownToken(nextToken)) continue;
@@ -320,4 +320,4 @@ void AppendTokenTo(Token src, Token dest)
_tokens.RemoveAll(token => token.Category == Token.TokenCategory.Invalid);
}
}
-}
+}
diff --git a/AnitomySharpTests/AnitomySharpTests.csproj b/AnitomySharpTests/AnitomySharpTests.csproj
new file mode 100644
index 0000000..245a899
--- /dev/null
+++ b/AnitomySharpTests/AnitomySharpTests.csproj
@@ -0,0 +1,29 @@
+
+
+
+ net7.0
+ enable
+ enable
+
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/AnitomySharpTests/DataTest.cs b/AnitomySharpTests/DataTest.cs
index 42e483f..1075921 100644
--- a/AnitomySharpTests/DataTest.cs
+++ b/AnitomySharpTests/DataTest.cs
@@ -67,8 +67,8 @@ private static void Verify(TestCase entry)
{
testValue = testCase.Value;
}
-
-
+
+
((Dictionary) parseResults["results"]).TryGetValue(testCase.Key, out var elValue);
switch (elValue)
{
@@ -95,10 +95,10 @@ private static Dictionary ToTestCaseDict(string filename)
if (o != null && o is List