Add lastupdated to sort for merged

This commit is contained in:
Matt Nadareski
2016-04-16 21:13:22 -07:00
parent 52fb28de80
commit b763103e79

View File

@@ -287,7 +287,6 @@ namespace SabreTools
/// <summary> /// <summary>
/// Preprocess the rom data that is to be included in the outputted DAT /// Preprocess the rom data that is to be included in the outputted DAT
/// </summary> /// </summary>
/// <remarks>To make this even more accurate, files with a more recent "LastUpdated" should be considered the parent if all else is the same.</remarks>
/// <returns>A List of RomData objects containing all information about the files</returns> /// <returns>A List of RomData objects containing all information about the files</returns>
public List<RomData> ProcessRoms() public List<RomData> ProcessRoms()
{ {
@@ -301,8 +300,8 @@ namespace SabreTools
string query = @" string query = @"
SELECT DISTINCT systems.manufacturer AS manufacturer, systems.system AS system, systems.id AS systemid, SELECT DISTINCT systems.manufacturer AS manufacturer, systems.system AS system, systems.id AS systemid,
sources.name AS source, sources.url AS url, sources.id AS sourceid, sources.name AS source, sources.url AS url, sources.id AS sourceid,
games.name AS game, files.name AS name, files.type AS type, checksums.size AS size, checksums.crc AS crc, games.name AS game, files.name AS name, files.type AS type, files.lastupdated AS lastupdated,
checksums.md5 AS md5, checksums.sha1 AS sha1 checksums.size AS size, checksums.crc AS crc, checksums.md5 AS md5, checksums.sha1 AS sha1
FROM systems FROM systems
JOIN games JOIN games
ON systems.id=games.system ON systems.id=games.system
@@ -317,7 +316,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, systems.id, sources.id, checksums.md5, checksums.sha1" (merged ? "checksums.size, checksums.crc, systems.id, sources.id, files.lastupdated, 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))