@@ -44,6 +44,15 @@ public List<Signatures_Games_2> GetRawSignatures(HashLookupModel model)
4444 }
4545 }
4646
47+ if ( model . CRC != null )
48+ {
49+ if ( model . CRC . Length == 8 )
50+ {
51+ whereClauses . Add ( "Signatures_Roms.CRC = @crc" ) ;
52+ dbDict . Add ( "crc" , model . CRC ) ;
53+ }
54+ }
55+
4756 if ( whereClauses . Count > 0 )
4857 {
4958 // lookup the provided hashes
@@ -223,19 +232,19 @@ public Signatures_Games_2.GameItem BuildGameItem(DataRow sigDbRow)
223232 return new Signatures_Games_2 . GameItem
224233 {
225234 Id = ( ( long ) sigDbRow [ "Id" ] ) . ToString ( ) ,
226- Name = ( string ) sigDbRow [ "Name" ] ,
227- Description = ( string ) sigDbRow [ "Description" ] ,
228- Year = ( string ) sigDbRow [ "Year" ] ,
235+ Name = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Name" ] , "" ) ,
236+ Description = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Description" ] , "" ) ,
237+ Year = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Year" ] , "" ) ,
229238 Publisher = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Publisher" ] , "" ) ,
230239 PublisherId = ( long ) ( int ) Common . ReturnValueIfNull ( sigDbRow [ "PublisherId" ] , "" ) ,
231240 Demo = ( Signatures_Games_2 . GameItem . DemoTypes ) ( int ) sigDbRow [ "Demo" ] ,
232- SystemId = ( int ) sigDbRow [ "PlatformId" ] ,
233- System = ( string ) sigDbRow [ "Platform" ] ,
234- SystemVariant = ( string ) sigDbRow [ "SystemVariant" ] ,
235- Video = ( string ) sigDbRow [ "Video" ] ,
241+ SystemId = ( int ) Common . ReturnValueIfNull ( sigDbRow [ "PlatformId" ] , 0 ) ,
242+ System = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Platform" ] , "" ) ,
243+ SystemVariant = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "SystemVariant" ] , "" ) ,
244+ Video = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Video" ] , "" ) ,
236245 Countries = new Dictionary < string , string > ( GetLookup ( LookupTypes . Country , ( long ) sigDbRow [ "Id" ] ) ) ,
237246 Languages = new Dictionary < string , string > ( GetLookup ( LookupTypes . Language , ( long ) sigDbRow [ "Id" ] ) ) ,
238- Copyright = ( string ) sigDbRow [ "Copyright" ] ,
247+ Copyright = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Copyright" ] , "" ) ,
239248 MetadataSource = ( int ) sigDbRow [ "MetadataSource" ] ,
240249 Category = ( string ) Common . ReturnValueIfNull ( sigDbRow [ "Category" ] , "" )
241250 } ;
@@ -341,11 +350,12 @@ public Dictionary<string, KeyValuePair<string, string>> GetLookupCorrections(Loo
341350 public hasheous_server . Models . Signatures_Games_2 . RomItem GetRomItemByHash ( hasheous_server . Models . HashLookupModel model )
342351 {
343352 Database db = new Database ( Database . databaseType . MySql , Config . DatabaseConfiguration . ConnectionString ) ;
344- string sql = "SELECT `Id` AS romid, `Name` AS romname, Signatures_Roms.* FROM Signatures_Roms WHERE MD5 = @md5 OR SHA1 = @sha1;" ;
353+ string sql = "SELECT `Id` AS romid, `Name` AS romname, Signatures_Roms.* FROM Signatures_Roms WHERE MD5 = @md5 OR SHA1 = @sha1 OR CRC = @crc ;" ;
345354
346355 return BuildRomItem ( db . ExecuteCMD ( sql , new Dictionary < string , object > {
347356 { "md5" , model . MD5 } ,
348- { "sha1" , model . SHA1 }
357+ { "sha1" , model . SHA1 } ,
358+ { "crc" , model . CRC }
349359 } ) . Rows [ 0 ] ) ;
350360 }
351361
0 commit comments