diff --git a/Gaseous.sln b/Gaseous.sln index 32f3f25..2e09c95 100644 --- a/Gaseous.sln +++ b/Gaseous.sln @@ -1,11 +1,13 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 25.0.1704.4 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-identifier-testapp", "gaseous-identifier\gaseous-identifier-testapp.csproj", "{F5C42134-5372-430A-A9AE-1871981850DB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-romsignatureobject", "gaseous-romsignatureobject\Gaseous-ROMSignatureObject.csproj", "{B0328A09-F50C-40BB-AC3D-040635AF927F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-signature-parser", "gaseous-signature-parser\gaseous-signature-parser.csproj", "{DAEBBB82-5051-43FD-A406-F9D64A38F468}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-romsignatureobject", "gaseous-romsignatureobject\gaseous-romsignatureobject.csproj", "{9DCD243D-37CE-4562-8411-B5242B687D4F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,10 +23,18 @@ Global {08699C93-15CD-4E39-9053-D3C8056CE938}.Debug|Any CPU.Build.0 = Debug|Any CPU {08699C93-15CD-4E39-9053-D3C8056CE938}.Release|Any CPU.ActiveCfg = Release|Any CPU {08699C93-15CD-4E39-9053-D3C8056CE938}.Release|Any CPU.Build.0 = Release|Any CPU - {B0328A09-F50C-40BB-AC3D-040635AF927F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0328A09-F50C-40BB-AC3D-040635AF927F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0328A09-F50C-40BB-AC3D-040635AF927F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0328A09-F50C-40BB-AC3D-040635AF927F}.Release|Any CPU.Build.0 = Release|Any CPU + {DAEBBB82-5051-43FD-A406-F9D64A38F468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAEBBB82-5051-43FD-A406-F9D64A38F468}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAEBBB82-5051-43FD-A406-F9D64A38F468}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAEBBB82-5051-43FD-A406-F9D64A38F468}.Release|Any CPU.Build.0 = Release|Any CPU + {FFCEC386-033F-4772-A45B-D33579F2E5EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFCEC386-033F-4772-A45B-D33579F2E5EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFCEC386-033F-4772-A45B-D33579F2E5EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFCEC386-033F-4772-A45B-D33579F2E5EE}.Release|Any CPU.Build.0 = Release|Any CPU + {9DCD243D-37CE-4562-8411-B5242B687D4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DCD243D-37CE-4562-8411-B5242B687D4F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DCD243D-37CE-4562-8411-B5242B687D4F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DCD243D-37CE-4562-8411-B5242B687D4F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/gaseous-identifier/Program.cs b/gaseous-identifier/Program.cs index 4430fdd..e7a4ef2 100644 --- a/gaseous-identifier/Program.cs +++ b/gaseous-identifier/Program.cs @@ -4,6 +4,8 @@ using System.Text; using System.Xml; using System.Xml.Serialization; using Newtonsoft.Json; +using gaseous_romsignatureobject; +using gaseous_signature_parser.parsers; string[] commandLineArgs = Environment.GetCommandLineArgs(); @@ -50,7 +52,7 @@ foreach (string commandLineArg in commandLineArgs) scanPath = Path.GetFullPath(scanPath); Console.WriteLine("ROM search path: " + scanPath); -List romSignatures = new List(); +List romSignatures = new List(); System.Collections.ArrayList availablePlatforms = new System.Collections.ArrayList(); // load TOSEC XML files @@ -66,14 +68,14 @@ if (tosecXML != null && tosecXML.Length > 0) { string tosecXMLFile = tosecPathContents[i]; - gaseous_identifier.classes.TosecParser tosecParser = new gaseous_identifier.classes.TosecParser(); - Gaseous_ROMSignatureObject.RomSignatureObject tosecObject = tosecParser.Parse(tosecXMLFile); + TosecParser tosecParser = new TosecParser(); + RomSignatureObject tosecObject = tosecParser.Parse(tosecXMLFile); string statusOutput = i + " / " + tosecPathContents.Length + " : " + Path.GetFileName(tosecXMLFile); Console.Write("\r " + statusOutput.PadRight(lastCLILineLength, ' ') + "\r"); lastCLILineLength = statusOutput.Length; - foreach (Gaseous_ROMSignatureObject.RomSignatureObject.Game gameRom in tosecObject.Games) + foreach (RomSignatureObject.Game gameRom in tosecObject.Games) { if (!availablePlatforms.Contains(gameRom.System)) { @@ -118,11 +120,11 @@ foreach (string romFile in romPathContents) string sha1Hash = BitConverter.ToString(sha1HashByte).Replace("-", "").ToLowerInvariant(); bool gameFound = false; - foreach (Gaseous_ROMSignatureObject.RomSignatureObject tosecList in romSignatures) + foreach (RomSignatureObject tosecList in romSignatures) { - foreach (Gaseous_ROMSignatureObject.RomSignatureObject.Game gameObject in tosecList.Games) + foreach (RomSignatureObject.Game gameObject in tosecList.Games) { - foreach (Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom romObject in gameObject.Roms) + foreach (RomSignatureObject.Game.Rom romObject in gameObject.Roms) { if (romObject.Md5 != null) { @@ -144,7 +146,7 @@ foreach (string romFile in romPathContents) { Console.WriteLine(romObject.Name); - Gaseous_ROMSignatureObject.RomSignatureObject.Game gameSignature = gameObject; + RomSignatureObject.Game gameSignature = gameObject; gameSignature.Roms.Clear(); gameSignature.Roms.Add(romObject); @@ -166,9 +168,9 @@ foreach (string romFile in romPathContents) } string SearchTitle = "California Games"; -foreach (Gaseous_ROMSignatureObject.RomSignatureObject romSignatureObject in romSignatures) +foreach (RomSignatureObject romSignatureObject in romSignatures) { - foreach (Gaseous_ROMSignatureObject.RomSignatureObject.Game gameObject in romSignatureObject.Games) + foreach (RomSignatureObject.Game gameObject in romSignatureObject.Games) { if (gameObject.Name == SearchTitle) { diff --git a/gaseous-identifier/gaseous-identifier-testapp.csproj b/gaseous-identifier/gaseous-identifier-testapp.csproj index 5b51fd7..02cc813 100644 --- a/gaseous-identifier/gaseous-identifier-testapp.csproj +++ b/gaseous-identifier/gaseous-identifier-testapp.csproj @@ -9,36 +9,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/gaseous-romsignatureobject/Gaseous-ROMSignatureObject.csproj b/gaseous-romsignatureobject/Gaseous-ROMSignatureObject.csproj deleted file mode 100644 index 7b43d45..0000000 --- a/gaseous-romsignatureobject/Gaseous-ROMSignatureObject.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - net7.0 - Gaseous_ROMSignatureObject - enable - enable - - - diff --git a/gaseous-romsignatureobject/RomSignatureObject.cs b/gaseous-romsignatureobject/RomSignatureObject.cs index 98cfde8..5c04359 100644 --- a/gaseous-romsignatureobject/RomSignatureObject.cs +++ b/gaseous-romsignatureobject/RomSignatureObject.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Gaseous_ROMSignatureObject +namespace gaseous_romsignatureobject { /// /// Object returned by all signature engines containing metadata about the ROM's in the data files diff --git a/gaseous-romsignatureobject/gaseous-romsignatureobject.csproj b/gaseous-romsignatureobject/gaseous-romsignatureobject.csproj index 7b43d45..f46a538 100644 --- a/gaseous-romsignatureobject/gaseous-romsignatureobject.csproj +++ b/gaseous-romsignatureobject/gaseous-romsignatureobject.csproj @@ -2,9 +2,12 @@ net7.0 - Gaseous_ROMSignatureObject + gaseous_romsignatureobject enable enable + + 4 + diff --git a/gaseous-identifier/Classes/TosecParser.cs b/gaseous-signature-parser/Parsers/TosecParser.cs similarity index 90% rename from gaseous-identifier/Classes/TosecParser.cs rename to gaseous-signature-parser/Parsers/TosecParser.cs index f6ea727..73a43e3 100644 --- a/gaseous-identifier/Classes/TosecParser.cs +++ b/gaseous-signature-parser/Parsers/TosecParser.cs @@ -3,18 +3,19 @@ using System.Xml; using System.IO; using System.Reflection; using System.Security.Cryptography; +using gaseous_romsignatureobject; -namespace gaseous_identifier.classes +namespace gaseous_signature_parser.parsers { public class TosecParser { - public Gaseous_ROMSignatureObject.RomSignatureObject Parse(string XMLFile) + public RomSignatureObject Parse(string XMLFile) { // load resources var assembly = Assembly.GetExecutingAssembly(); // load systems list List TOSECSystems = new List(); - var resourceName = "gaseous_identifier.Support.Parsers.TOSEC.Systems.txt"; + var resourceName = "gaseous_signature_parser.Support.Parsers.TOSEC.Systems.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { @@ -22,7 +23,7 @@ namespace gaseous_identifier.classes } // load video list List TOSECVideo = new List(); - resourceName = "gaseous_identifier.Support.Parsers.TOSEC.Video.txt"; + resourceName = "gaseous_signature_parser.Support.Parsers.TOSEC.Video.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { @@ -30,7 +31,7 @@ namespace gaseous_identifier.classes } // load country list Dictionary TOSECCountry = new Dictionary(); - resourceName = "gaseous_identifier.Support.Parsers.TOSEC.Country.txt"; + resourceName = "gaseous_signature_parser.Support.Parsers.TOSEC.Country.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { @@ -42,7 +43,7 @@ namespace gaseous_identifier.classes } // load language list Dictionary TOSECLanguage = new Dictionary(); - resourceName = "gaseous_identifier.Support.Parsers.TOSEC.Language.txt"; + resourceName = "gaseous_signature_parser.Support.Parsers.TOSEC.Language.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { @@ -54,7 +55,7 @@ namespace gaseous_identifier.classes } // load copyright list Dictionary TOSECCopyright = new Dictionary(); - resourceName = "gaseous_identifier.Support.Parsers.TOSEC.Copyright.txt"; + resourceName = "gaseous_signature_parser.Support.Parsers.TOSEC.Copyright.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { @@ -66,7 +67,7 @@ namespace gaseous_identifier.classes } // load development status list Dictionary TOSECDevelopment = new Dictionary(); - resourceName = "gaseous_identifier.Support.Parsers.TOSEC.DevelopmentStatus.txt"; + resourceName = "gaseous_signature_parser.Support.Parsers.TOSEC.DevelopmentStatus.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { @@ -92,7 +93,7 @@ namespace gaseous_identifier.classes XmlDocument tosecXmlDoc = new XmlDocument(); tosecXmlDoc.Load(XMLFile); - Gaseous_ROMSignatureObject.RomSignatureObject tosecObject = new Gaseous_ROMSignatureObject.RomSignatureObject(); + RomSignatureObject tosecObject = new RomSignatureObject(); // get header XmlNode xmlHeader = tosecXmlDoc.DocumentElement.SelectSingleNode("/datafile/header"); @@ -145,11 +146,11 @@ namespace gaseous_identifier.classes } // get games - tosecObject.Games = new List(); + tosecObject.Games = new List(); XmlNodeList xmlGames = tosecXmlDoc.DocumentElement.SelectNodes("/datafile/game"); foreach (XmlNode xmlGame in xmlGames) { - Gaseous_ROMSignatureObject.RomSignatureObject.Game gameObject = new Gaseous_ROMSignatureObject.RomSignatureObject.Game(); + RomSignatureObject.Game gameObject = new RomSignatureObject.Game(); // parse game name string[] gameNameTitleParts = xmlGame.Attributes["name"].Value.Split("["); @@ -158,32 +159,32 @@ namespace gaseous_identifier.classes // before split, save and remove the demo tag if present if (gameName.Contains("(demo) ", StringComparison.CurrentCulture)) { - gameObject.Demo = Gaseous_ROMSignatureObject.RomSignatureObject.Game.DemoTypes.demo; + gameObject.Demo = RomSignatureObject.Game.DemoTypes.demo; gameName = gameName.Replace("(demo) ", ""); } else if (gameName.Contains("(demo-kiosk) ", StringComparison.CurrentCulture)) { - gameObject.Demo = Gaseous_ROMSignatureObject.RomSignatureObject.Game.DemoTypes.demo_kiosk; + gameObject.Demo = RomSignatureObject.Game.DemoTypes.demo_kiosk; gameName = gameName.Replace("(demo-kiosk) ", ""); } else if (gameName.Contains("(demo-playable) ", StringComparison.CurrentCulture)) { - gameObject.Demo = Gaseous_ROMSignatureObject.RomSignatureObject.Game.DemoTypes.demo_playable; + gameObject.Demo = RomSignatureObject.Game.DemoTypes.demo_playable; gameName = gameName.Replace("(demo-playable) ", ""); } else if (gameName.Contains("(demo-rolling) ", StringComparison.CurrentCulture)) { - gameObject.Demo = Gaseous_ROMSignatureObject.RomSignatureObject.Game.DemoTypes.demo_rolling; + gameObject.Demo = RomSignatureObject.Game.DemoTypes.demo_rolling; gameName = gameName.Replace("(demo-rolling) ", ""); } else if (gameName.Contains("(demo-slideshow) ", StringComparison.CurrentCulture)) { - gameObject.Demo = Gaseous_ROMSignatureObject.RomSignatureObject.Game.DemoTypes.demo_slideshow; + gameObject.Demo = RomSignatureObject.Game.DemoTypes.demo_slideshow; gameName = gameName.Replace("(demo-slideshow) ", ""); } else { - gameObject.Demo = Gaseous_ROMSignatureObject.RomSignatureObject.Game.DemoTypes.NotDemo; + gameObject.Demo = RomSignatureObject.Game.DemoTypes.NotDemo; } string[] gameNameTokens = gameName.Split("("); @@ -336,7 +337,7 @@ namespace gaseous_identifier.classes StartToken += 1; } - gameObject.Roms = new List(); + gameObject.Roms = new List(); // get the roms string romDescription = ""; @@ -349,7 +350,7 @@ namespace gaseous_identifier.classes break; case "rom": - Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom romObject = new Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom(); + RomSignatureObject.Game.Rom romObject = new RomSignatureObject.Game.Rom(); romObject.Name = xmlGameDetail.Attributes["name"]?.Value; romObject.Size = UInt64.Parse(xmlGameDetail.Attributes["size"]?.Value); romObject.Crc = xmlGameDetail.Attributes["crc"]?.Value; @@ -382,22 +383,22 @@ namespace gaseous_identifier.classes switch (tokens[0]) { case "Disc": - romObject.RomType = Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom.RomTypes.Disc; + romObject.RomType = RomSignatureObject.Game.Rom.RomTypes.Disc; break; case "Disk": - romObject.RomType = Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom.RomTypes.Disk; + romObject.RomType = RomSignatureObject.Game.Rom.RomTypes.Disk; break; case "File": - romObject.RomType = Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom.RomTypes.File; + romObject.RomType = RomSignatureObject.Game.Rom.RomTypes.File; break; case "Part": - romObject.RomType = Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom.RomTypes.Part; + romObject.RomType = RomSignatureObject.Game.Rom.RomTypes.Part; break; case "Side": - romObject.RomType = Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom.RomTypes.Side; + romObject.RomType = RomSignatureObject.Game.Rom.RomTypes.Side; break; case "Tape": - romObject.RomType = Gaseous_ROMSignatureObject.RomSignatureObject.Game.Rom.RomTypes.Tape; + romObject.RomType = RomSignatureObject.Game.Rom.RomTypes.Tape; break; } romObject.RomTypeMedia = token; @@ -487,7 +488,7 @@ namespace gaseous_identifier.classes // search for existing gameObject to update bool existingGameFound = false; - foreach (Gaseous_ROMSignatureObject.RomSignatureObject.Game existingGame in tosecObject.Games) + foreach (RomSignatureObject.Game existingGame in tosecObject.Games) { if (existingGame.Name == gameObject.Name && existingGame.Year == gameObject.Year && diff --git a/gaseous-identifier/Support/Parsers/TOSEC/Copyright.txt b/gaseous-signature-parser/Support/Parsers/TOSEC/Copyright.txt similarity index 100% rename from gaseous-identifier/Support/Parsers/TOSEC/Copyright.txt rename to gaseous-signature-parser/Support/Parsers/TOSEC/Copyright.txt diff --git a/gaseous-identifier/Support/Parsers/TOSEC/Country.txt b/gaseous-signature-parser/Support/Parsers/TOSEC/Country.txt similarity index 100% rename from gaseous-identifier/Support/Parsers/TOSEC/Country.txt rename to gaseous-signature-parser/Support/Parsers/TOSEC/Country.txt diff --git a/gaseous-identifier/Support/Parsers/TOSEC/DevelopmentStatus.txt b/gaseous-signature-parser/Support/Parsers/TOSEC/DevelopmentStatus.txt similarity index 100% rename from gaseous-identifier/Support/Parsers/TOSEC/DevelopmentStatus.txt rename to gaseous-signature-parser/Support/Parsers/TOSEC/DevelopmentStatus.txt diff --git a/gaseous-identifier/Support/Parsers/TOSEC/Language.txt b/gaseous-signature-parser/Support/Parsers/TOSEC/Language.txt similarity index 100% rename from gaseous-identifier/Support/Parsers/TOSEC/Language.txt rename to gaseous-signature-parser/Support/Parsers/TOSEC/Language.txt diff --git a/gaseous-identifier/Support/Parsers/TOSEC/Systems.txt b/gaseous-signature-parser/Support/Parsers/TOSEC/Systems.txt similarity index 100% rename from gaseous-identifier/Support/Parsers/TOSEC/Systems.txt rename to gaseous-signature-parser/Support/Parsers/TOSEC/Systems.txt diff --git a/gaseous-identifier/Support/Parsers/TOSEC/Video.txt b/gaseous-signature-parser/Support/Parsers/TOSEC/Video.txt similarity index 100% rename from gaseous-identifier/Support/Parsers/TOSEC/Video.txt rename to gaseous-signature-parser/Support/Parsers/TOSEC/Video.txt diff --git a/gaseous-signature-parser/gaseous-signature-parser.csproj b/gaseous-signature-parser/gaseous-signature-parser.csproj new file mode 100644 index 0000000..f09d93a --- /dev/null +++ b/gaseous-signature-parser/gaseous-signature-parser.csproj @@ -0,0 +1,38 @@ + + + + net7.0 + gaseous_signature_parser + enable + enable + + + + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + +