diff --git a/gaseous-identifier/Classes/TosecParser.cs b/gaseous-identifier/Classes/TosecParser.cs index 0349e56..451b0ed 100644 --- a/gaseous-identifier/Classes/TosecParser.cs +++ b/gaseous-identifier/Classes/TosecParser.cs @@ -397,11 +397,11 @@ namespace gaseous_identifier.classes ( token != romObject.RomTypeMedia && token != gameObject.Publisher && + token != gameObject.SystemVariant && + token != gameObject.Video && token != gameObject.Country.Key && token != gameObject.Copyright.Key && token != gameObject.Language.Key && - token != gameObject.SystemVariant && - token != gameObject.Video && token != gameObject.DevelopmentStatus.Key ) ) @@ -409,6 +409,55 @@ namespace gaseous_identifier.classes // likely the media label? romObject.MediaLabel = token; } + + // process dump flags + if (rawToken.IndexOf("[") > 0) + { + // has dump flags + string rawDumpFlags = rawToken.Substring(rawToken.IndexOf("[")); + string[] dumpFlags = rawDumpFlags.Split("["); + foreach (string dumpFlag in dumpFlags) + { + string dToken = dumpFlag.Replace("]", ""); + if (dToken.Length > 0) + { + string[] dTokenCompare = dToken.Split(" "); + switch (dTokenCompare[0].Trim().ToLower()) + { + case "cr": + // cracked + case "f": + // fixed + case "h": + // hacked + case "m": + // modified + case "p": + // pirated + case "t": + // trained + case "tr": + // translated + case "o": + // overdump + case "u": + // underdump + case "v": + // virus + case "b": + // bad dump + case "a": + // alternate + case "!": + // known verified dump + // ------------------- + romObject.flags.Add(dToken); + break; + } + + } + } + } } gameObject.Roms.Add(romObject); diff --git a/gaseous-identifier/Objects/RomSignatureObject.cs b/gaseous-identifier/Objects/RomSignatureObject.cs index 6d7482c..d6ff210 100644 --- a/gaseous-identifier/Objects/RomSignatureObject.cs +++ b/gaseous-identifier/Objects/RomSignatureObject.cs @@ -56,7 +56,7 @@ namespace gaseous_identifier.objects public string? Md5 { get; set; } public string? Sha1 { get; set; } - public string? flags { get; set; } + public List flags { get; set; } = new List(); public RomTypes RomType { get; set; } public string? RomTypeMedia { get; set; } diff --git a/gaseous-identifier/Program.cs b/gaseous-identifier/Program.cs index bfdfe5a..48ad5ac 100644 --- a/gaseous-identifier/Program.cs +++ b/gaseous-identifier/Program.cs @@ -3,6 +3,7 @@ using System.Security.Cryptography; using System.Text; using System.Xml; using System.Xml.Serialization; +using Newtonsoft.Json; string[] commandLineArgs = Environment.GetCommandLineArgs(); @@ -135,7 +136,10 @@ foreach (string romFile in romPathContents) gameSignature.Roms.Clear(); gameSignature.Roms.Add(romObject); - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(gameSignature, Newtonsoft.Json.Formatting.Indented)); + var jsonSerializerSettings = new JsonSerializerSettings(); + jsonSerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); + jsonSerializerSettings.NullValueHandling = NullValueHandling.Ignore; + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(gameSignature, Newtonsoft.Json.Formatting.Indented, jsonSerializerSettings)); break; } }