From 4c844f99cd9ca3eb11b9303ac83ba98d2d6a70a3 Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:56:20 +1100 Subject: [PATCH] refactor: fixed bug with parsing publisher --- gaseous-identifier/Classes/TosecParser.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gaseous-identifier/Classes/TosecParser.cs b/gaseous-identifier/Classes/TosecParser.cs index abd47ac..7b575c7 100644 --- a/gaseous-identifier/Classes/TosecParser.cs +++ b/gaseous-identifier/Classes/TosecParser.cs @@ -152,7 +152,8 @@ namespace gaseous_identifier.classes objects.RomSignatureObject.Game gameObject = new objects.RomSignatureObject.Game(); // 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 if (gameName.Contains("(demo) ", StringComparison.CurrentCulture)) @@ -338,12 +339,13 @@ namespace gaseous_identifier.classes gameObject.Roms = new List(); // get the roms + string romDescription = ""; foreach (XmlNode xmlGameDetail in xmlGame.ChildNodes) { switch (xmlGameDetail.Name.ToLower()) { case "description": - //gameObject.Description = xmlGameDetail.InnerText; + romDescription = xmlGameDetail.InnerText; break; case "rom": @@ -355,8 +357,8 @@ namespace gaseous_identifier.classes romObject.Sha1 = xmlGameDetail.Attributes["sha1"]?.Value; // parse name - string[] romNameTokens = romObject.Name.Split("("); - foreach (string rawToken in gameNameTokens) { + string[] romNameTokens = romDescription.Split("("); + foreach (string rawToken in romNameTokens) { string[] tokenSplit = rawToken.Split("["); // replace the extra closing bracket