[DatFile] Make the file dictionary transparent

This commit is contained in:
Matt Nadareski
2016-11-08 15:29:52 -08:00
parent a13f0f1635
commit 82a31ed470
10 changed files with 276 additions and 380 deletions

View File

@@ -443,9 +443,9 @@ namespace SabreTools
// Loop through the Dictionary and add all data
_logger.User("Adding new DAT information");
start = DateTime.Now;
foreach (string key in datroot.Files.Keys)
foreach (string key in datroot.Keys())
{
foreach (Rom value in datroot.Files[key])
foreach (Rom value in datroot[key])
{
AddDatToDatabase(value, dbc);
}
@@ -481,7 +481,7 @@ namespace SabreTools
// If the Dat wasn't empty, add the information
SqliteCommand slc = new SqliteCommand();
if (tempdat.Files.Count != 0)
if (tempdat.Count != 0)
{
string crcquery = "INSERT OR IGNORE INTO crc (crc) VALUES";
string md5query = "INSERT OR IGNORE INTO md5 (md5) VALUES";

View File

@@ -106,16 +106,7 @@ namespace SabreTools
}
// Add to the Dat
if (need.Files.ContainsKey(key))
{
need.Files[key].Add(rom);
}
else
{
List<DatItem> temp = new List<DatItem>();
temp.Add(rom);
need.Files.Add(key, temp);
}
need.Add(key, rom);
}
}
// Otherwise, just add the file to the list
@@ -145,16 +136,7 @@ namespace SabreTools
}
// Add to the Dat
if (need.Files.ContainsKey(key))
{
need.Files[key].Add(rom);
}
else
{
List<DatItem> temp = new List<DatItem>();
temp.Add(rom);
need.Files.Add(key, temp);
}
need.Add(key, rom);
}
}
}