(Hopefully) resolved issues with the media label field

This commit is contained in:
Michael Green
2023-02-16 17:28:44 +11:00
parent 5377615bc2
commit e36b49d82f
3 changed files with 26 additions and 16 deletions

View File

@@ -256,14 +256,6 @@ namespace gaseous_identifier.classes
StartToken += 1; StartToken += 1;
} }
gameObject.Roms = new List<objects.RomSignatureObject.Game.Rom>(); gameObject.Roms = new List<objects.RomSignatureObject.Game.Rom>();
// get the roms // get the roms
@@ -326,12 +318,17 @@ namespace gaseous_identifier.classes
// check for media label // check for media label
if (token.Length > 0 && if (token.Length > 0 &&
token == gameNameTokens.Last() && (token + ")") == gameNameTokens.Last() &&
gameNameTokens.Length > 2 &&
( (
token != romObject.RomTypeMedia && token != romObject.RomTypeMedia &&
token != gameObject.Publisher && token != gameObject.Publisher &&
token != gameObject.Country.Key) token != gameObject.Country.Key &&
token != gameObject.Copyright.Key &&
token != gameObject.Language.Key &&
token != gameObject.SystemVariant &&
token != gameObject.Video &&
token != gameObject.DevelopmentStatus.Key
)
) )
{ {
// likely the media label? // likely the media label?

View File

@@ -105,14 +105,23 @@ foreach (string romFile in romPathContents)
{ {
foreach (gaseous_identifier.objects.RomSignatureObject.Game.Rom romObject in gameObject.Roms) foreach (gaseous_identifier.objects.RomSignatureObject.Game.Rom romObject in gameObject.Roms)
{ {
if (md5Hash == romObject.Md5) if (romObject.Md5 != null)
{
if (md5Hash == romObject.Md5.ToLowerInvariant())
{ {
// match // match
gameFound = true; gameFound = true;
Console.WriteLine(romObject.Name); Console.WriteLine(romObject.Name);
gaseous_identifier.objects.RomSignatureObject.Game gameSignature = gameObject;
gameSignature.Roms.Clear();
gameSignature.Roms.Add(romObject);
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(gameSignature, Newtonsoft.Json.Formatting.Indented));
break; break;
} }
} }
}
if (gameFound == true) { break; } if (gameFound == true) { break; }
} }
if (gameFound == true) { break; } if (gameFound == true) { break; }

View File

@@ -19,6 +19,7 @@
<None Remove="Support\Parsers\TOSEC\Language.txt" /> <None Remove="Support\Parsers\TOSEC\Language.txt" />
<None Remove="Support\Parsers\TOSEC\Copyright.txt" /> <None Remove="Support\Parsers\TOSEC\Copyright.txt" />
<None Remove="Support\Parsers\TOSEC\DevelopmentStatus.txt" /> <None Remove="Support\Parsers\TOSEC\DevelopmentStatus.txt" />
<None Remove="Newtonsoft.Json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Classes\" /> <Folder Include="Classes\" />
@@ -34,4 +35,7 @@
<EmbeddedResource Include="Support\Parsers\TOSEC\Copyright.txt" /> <EmbeddedResource Include="Support\Parsers\TOSEC\Copyright.txt" />
<EmbeddedResource Include="Support\Parsers\TOSEC\DevelopmentStatus.txt" /> <EmbeddedResource Include="Support\Parsers\TOSEC\DevelopmentStatus.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
</Project> </Project>