refactor: fixed bug with parsing publisher

This commit is contained in:
Michael Green
2023-02-21 22:56:20 +11:00
parent f84d5e8ec7
commit 4c844f99cd

View File

@@ -152,7 +152,8 @@ namespace gaseous_identifier.classes
objects.RomSignatureObject.Game gameObject = new objects.RomSignatureObject.Game(); objects.RomSignatureObject.Game gameObject = new objects.RomSignatureObject.Game();
// parse game name // parse game name
string gameName = xmlGame.Attributes["name"].Value; string[] gameNameTitleParts = xmlGame.Attributes["name"].Value.Split("[");
string gameName = gameNameTitleParts[0];
// before split, save and remove the demo tag if present // before split, save and remove the demo tag if present
if (gameName.Contains("(demo) ", StringComparison.CurrentCulture)) if (gameName.Contains("(demo) ", StringComparison.CurrentCulture))
@@ -338,12 +339,13 @@ namespace gaseous_identifier.classes
gameObject.Roms = new List<objects.RomSignatureObject.Game.Rom>(); gameObject.Roms = new List<objects.RomSignatureObject.Game.Rom>();
// get the roms // get the roms
string romDescription = "";
foreach (XmlNode xmlGameDetail in xmlGame.ChildNodes) foreach (XmlNode xmlGameDetail in xmlGame.ChildNodes)
{ {
switch (xmlGameDetail.Name.ToLower()) switch (xmlGameDetail.Name.ToLower())
{ {
case "description": case "description":
//gameObject.Description = xmlGameDetail.InnerText; romDescription = xmlGameDetail.InnerText;
break; break;
case "rom": case "rom":
@@ -355,8 +357,8 @@ namespace gaseous_identifier.classes
romObject.Sha1 = xmlGameDetail.Attributes["sha1"]?.Value; romObject.Sha1 = xmlGameDetail.Attributes["sha1"]?.Value;
// parse name // parse name
string[] romNameTokens = romObject.Name.Split("("); string[] romNameTokens = romDescription.Split("(");
foreach (string rawToken in gameNameTokens) { foreach (string rawToken in romNameTokens) {
string[] tokenSplit = rawToken.Split("["); string[] tokenSplit = rawToken.Split("[");
// replace the extra closing bracket // replace the extra closing bracket