mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix merging order and bump version number
This commit is contained in:
@@ -275,7 +275,7 @@ JOIN checksums
|
|||||||
(_systems != "" && _sources != "" ? " AND" : "") +
|
(_systems != "" && _sources != "" ? " AND" : "") +
|
||||||
(_systems != "" ? " systems.id in (" + _systems + ")" : "") +
|
(_systems != "" ? " systems.id in (" + _systems + ")" : "") +
|
||||||
"\nORDER BY " +
|
"\nORDER BY " +
|
||||||
(merged ? "checksums.size, checksums.crc, checksums.md5, checksums.sha1"
|
(merged ? "checksums.size, checksums.crc, systems.id, sources.id, checksums.md5, checksums.sha1"
|
||||||
: "systems.id, sources.id, games.name, files.name");
|
: "systems.id, sources.id, games.name, files.name");
|
||||||
|
|
||||||
using (SQLiteConnection dbc = new SQLiteConnection(_connectionString))
|
using (SQLiteConnection dbc = new SQLiteConnection(_connectionString))
|
||||||
@@ -313,9 +313,13 @@ JOIN checksums
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (merged)
|
if (merged)
|
||||||
|
{
|
||||||
|
// If it's the first rom in the list, don't touch it
|
||||||
|
if (roms.Count != 0)
|
||||||
{
|
{
|
||||||
// Check if the rom is a duplicate
|
// Check if the rom is a duplicate
|
||||||
RomData last = (roms.Count == 0 ? new RomData() : roms[roms.Count - 1]);
|
RomData last = roms[roms.Count - 1];
|
||||||
|
|
||||||
bool shouldcont = false;
|
bool shouldcont = false;
|
||||||
if (temp.Type == "rom" && last.Type == "rom")
|
if (temp.Type == "rom" && last.Type == "rom")
|
||||||
{
|
{
|
||||||
@@ -339,11 +343,13 @@ JOIN checksums
|
|||||||
last.CRC = (last.CRC == "" && temp.CRC != "" ? temp.CRC : last.CRC);
|
last.CRC = (last.CRC == "" && temp.CRC != "" ? temp.CRC : last.CRC);
|
||||||
last.MD5 = (last.MD5 == "" && temp.MD5 != "" ? temp.MD5 : last.MD5);
|
last.MD5 = (last.MD5 == "" && temp.MD5 != "" ? temp.MD5 : last.MD5);
|
||||||
last.SHA1 = (last.SHA1 == "" && temp.SHA1 != "" ? temp.SHA1 : last.SHA1);
|
last.SHA1 = (last.SHA1 == "" && temp.SHA1 != "" ? temp.SHA1 : last.SHA1);
|
||||||
|
|
||||||
roms.RemoveAt(roms.Count - 1);
|
roms.RemoveAt(roms.Count - 1);
|
||||||
roms.Insert(roms.Count - 1, last);
|
roms.Insert(roms.Count, last);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Rename the game associated if it's still valid and we allow renames
|
// Rename the game associated if it's still valid and we allow renames
|
||||||
if (!_norename)
|
if (!_norename)
|
||||||
@@ -361,6 +367,8 @@ JOIN checksums
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we're in a merged mode, resort by the correct parameters
|
// If we're in a merged mode, resort by the correct parameters
|
||||||
|
if (merged)
|
||||||
|
{
|
||||||
roms.Sort(delegate (RomData x, RomData y)
|
roms.Sort(delegate (RomData x, RomData y)
|
||||||
{
|
{
|
||||||
if (x.SystemID == y.SystemID)
|
if (x.SystemID == y.SystemID)
|
||||||
@@ -377,6 +385,7 @@ JOIN checksums
|
|||||||
}
|
}
|
||||||
return (_norename ? String.Compare(x.Game, y.Game) : x.SystemID - y.SystemID);
|
return (_norename ? String.Compare(x.Game, y.Game) : x.SystemID - y.SystemID);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Now check rename within games
|
// Now check rename within games
|
||||||
string lastname = "", lastgame = "";
|
string lastname = "", lastgame = "";
|
||||||
|
|||||||
@@ -333,9 +333,9 @@ namespace WoD
|
|||||||
child.Attributes["name"].Value,
|
child.Attributes["name"].Value,
|
||||||
date,
|
date,
|
||||||
(child.Attributes["size"] != null ? Int32.Parse(child.Attributes["size"].Value) : -1),
|
(child.Attributes["size"] != null ? Int32.Parse(child.Attributes["size"].Value) : -1),
|
||||||
(child.Attributes["crc"] != null ? child.Attributes["crc"].Value.ToLowerInvariant() : ""),
|
(child.Attributes["crc"] != null ? child.Attributes["crc"].Value.ToLowerInvariant().Trim() : ""),
|
||||||
(child.Attributes["md5"] != null ? child.Attributes["md5"].Value.ToLowerInvariant() : ""),
|
(child.Attributes["md5"] != null ? child.Attributes["md5"].Value.ToLowerInvariant().Trim() : ""),
|
||||||
(child.Attributes["sha1"] != null ? child.Attributes["sha1"].Value.ToLowerInvariant() : "")
|
(child.Attributes["sha1"] != null ? child.Attributes["sha1"].Value.ToLowerInvariant().Trim() : "")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// If we find the signs of a software list, traverse the children
|
// If we find the signs of a software list, traverse the children
|
||||||
@@ -357,9 +357,9 @@ namespace WoD
|
|||||||
data.Attributes["name"].Value,
|
data.Attributes["name"].Value,
|
||||||
date,
|
date,
|
||||||
(data.Attributes["size"] != null ? Int32.Parse(data.Attributes["size"].Value) : -1),
|
(data.Attributes["size"] != null ? Int32.Parse(data.Attributes["size"].Value) : -1),
|
||||||
(data.Attributes["crc"] != null ? data.Attributes["crc"].Value.ToLowerInvariant() : ""),
|
(data.Attributes["crc"] != null ? data.Attributes["crc"].Value.ToLowerInvariant().Trim() : ""),
|
||||||
(data.Attributes["md5"] != null ? data.Attributes["md5"].Value.ToLowerInvariant() : ""),
|
(data.Attributes["md5"] != null ? data.Attributes["md5"].Value.ToLowerInvariant().Trim() : ""),
|
||||||
(data.Attributes["sha1"] != null ? data.Attributes["sha1"].Value.ToLowerInvariant() : "")
|
(data.Attributes["sha1"] != null ? data.Attributes["sha1"].Value.ToLowerInvariant().Trim() : "")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace WoD
|
|||||||
{
|
{
|
||||||
private static string _dbName = "DATabase.sqlite";
|
private static string _dbName = "DATabase.sqlite";
|
||||||
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
|
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
|
||||||
private static string _version = "0.0.6.0";
|
private static string _version = "0.0.6.1";
|
||||||
private static string _header =
|
private static string _header =
|
||||||
@"+-----------------------------------------------------------------------------+
|
@"+-----------------------------------------------------------------------------+
|
||||||
| DATabase " + _version + @" |
|
| DATabase " + _version + @" |
|
||||||
|
|||||||
Reference in New Issue
Block a user