refactor: moved import file name version trimming
This commit is contained in:
@@ -191,10 +191,6 @@ namespace gaseous_server.Classes
|
|||||||
// search discovered game - case insensitive exact match first
|
// search discovered game - case insensitive exact match first
|
||||||
IGDB.Models.Game determinedGame = new IGDB.Models.Game();
|
IGDB.Models.Game determinedGame = new IGDB.Models.Game();
|
||||||
|
|
||||||
// remove version numbers from name
|
|
||||||
GameName = Regex.Replace(GameName, @"v(\d+\.)?(\d+\.)?(\*|\d+)$", "").Trim();
|
|
||||||
GameName = Regex.Replace(GameName, @"Rev (\d+\.)?(\d+\.)?(\*|\d+)$", "").Trim();
|
|
||||||
|
|
||||||
List<string> SearchCandidates = GetSearchCandidates(GameName);
|
List<string> SearchCandidates = GetSearchCandidates(GameName);
|
||||||
|
|
||||||
foreach (string SearchCandidate in SearchCandidates)
|
foreach (string SearchCandidate in SearchCandidates)
|
||||||
@@ -244,10 +240,6 @@ namespace gaseous_server.Classes
|
|||||||
{
|
{
|
||||||
List<IGDB.Models.Game> searchResults = new List<IGDB.Models.Game>();
|
List<IGDB.Models.Game> searchResults = new List<IGDB.Models.Game>();
|
||||||
|
|
||||||
// remove version numbers from name
|
|
||||||
GameName = Regex.Replace(GameName, @"v(\d+\.)?(\d+\.)?(\*|\d+)$", "").Trim();
|
|
||||||
GameName = Regex.Replace(GameName, @"Rev (\d+\.)?(\d+\.)?(\*|\d+)$", "").Trim();
|
|
||||||
|
|
||||||
List<string> SearchCandidates = GetSearchCandidates(GameName);
|
List<string> SearchCandidates = GetSearchCandidates(GameName);
|
||||||
|
|
||||||
foreach (string SearchCandidate in SearchCandidates)
|
foreach (string SearchCandidate in SearchCandidates)
|
||||||
@@ -283,19 +275,24 @@ namespace gaseous_server.Classes
|
|||||||
|
|
||||||
private static List<string> GetSearchCandidates(string GameName)
|
private static List<string> GetSearchCandidates(string GameName)
|
||||||
{
|
{
|
||||||
|
// remove version numbers from name
|
||||||
|
GameName = Regex.Replace(GameName, @"v(\d+\.)?(\d+\.)?(\*|\d+)$", "").Trim();
|
||||||
|
GameName = Regex.Replace(GameName, @"Rev (\d+\.)?(\d+\.)?(\*|\d+)$", "").Trim();
|
||||||
|
|
||||||
List<string> SearchCandidates = new List<string>();
|
List<string> SearchCandidates = new List<string>();
|
||||||
SearchCandidates.Add(GameName);
|
SearchCandidates.Add(GameName);
|
||||||
if (GameName.Contains(":"))
|
if (GameName.Contains(" - "))
|
||||||
{
|
{
|
||||||
GameName = GameName.Substring(0, GameName.IndexOf(":"));
|
SearchCandidates.Add(GameName.Replace(" - ", ": "));
|
||||||
SearchCandidates.Add(GameName.Trim());
|
SearchCandidates.Add(GameName.Substring(0, GameName.IndexOf(" - ")).Trim());
|
||||||
}
|
}
|
||||||
if (GameName.Contains("-"))
|
if (GameName.Contains(": "))
|
||||||
{
|
{
|
||||||
GameName = GameName.Substring(0, GameName.IndexOf("-"));
|
SearchCandidates.Add(GameName.Substring(0, GameName.IndexOf(": ")).Trim());
|
||||||
SearchCandidates.Add(GameName.Trim());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logging.Log(Logging.LogType.Information, "Import Game", " Search candidates: " + String.Join(", ", SearchCandidates));
|
||||||
|
|
||||||
return SearchCandidates;
|
return SearchCandidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,5 +72,22 @@
|
|||||||
"KnownFileExtensions": [
|
"KnownFileExtensions": [
|
||||||
".Z64"
|
".Z64"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IGDBId": 18,
|
||||||
|
"IGDBName": "Nintendo Entertainment System",
|
||||||
|
"AlternateNames": [
|
||||||
|
"Nintendo Entertainment System",
|
||||||
|
"NES"
|
||||||
|
],
|
||||||
|
"KnownFileExtensions": [
|
||||||
|
".NES",
|
||||||
|
".FDS",
|
||||||
|
".FIG",
|
||||||
|
".MGD",
|
||||||
|
".SFC",
|
||||||
|
".SMC",
|
||||||
|
".SWC"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user