[DATFromDir] Force file order parity

This commit is contained in:
Matt Nadareski
2016-09-14 11:05:40 -07:00
parent c44b9ee5b7
commit b5307b79c3
4 changed files with 18 additions and 8 deletions

View File

@@ -155,7 +155,9 @@ namespace SabreTools
// Then process each of the subfolders themselves // Then process each of the subfolders themselves
string basePathBackup = _basePath; string basePathBackup = _basePath;
foreach (string item in Directory.EnumerateDirectories(_basePath)) List<string> dirs = Directory.EnumerateDirectories(_basePath).ToList();
dirs.Sort(Style.CompareNumeric);
foreach (string item in dirs)
{ {
if (_datdata.Type != "SuperDAT") if (_datdata.Type != "SuperDAT")
{ {
@@ -164,7 +166,9 @@ namespace SabreTools
} }
bool items = false; bool items = false;
foreach (string subitem in Directory.EnumerateFiles(item, "*", SearchOption.AllDirectories)) List<string> files = Directory.EnumerateFiles(item, "*", SearchOption.AllDirectories).ToList();
files.Sort(Style.CompareNumeric);
foreach (string subitem in files)
{ {
items = true; items = true;
lastparent = ProcessPossibleArchive(subitem, sw, lastparent); lastparent = ProcessPossibleArchive(subitem, sw, lastparent);

View File

@@ -401,7 +401,7 @@ namespace SabreTools
foreach (string key in sortable.Keys) foreach (string key in sortable.Keys)
{ {
List<Rom> roms = sortable[key]; List<Rom> roms = sortable[key];
RomTools.Sort(roms, true); RomTools.Sort(ref roms, true);
long gameid = -1; long gameid = -1;
using (SqliteConnection dbc = new SqliteConnection(_connectionString)) using (SqliteConnection dbc = new SqliteConnection(_connectionString))

View File

@@ -1779,9 +1779,12 @@ namespace SabreTools.Helper
} }
// Now go through and sort all of the lists // Now go through and sort all of the lists
foreach (string key in sortable.Keys) List<string> keys = sortable.Keys.ToList();
foreach (string key in keys)
{ {
RomTools.Sort(sortable[key], norename); List<Rom> sortedlist = sortable[key];
RomTools.Sort(ref sortedlist, norename);
sortable[key] = sortedlist;
} }
// Output the count if told to // Output the count if told to
@@ -1856,9 +1859,12 @@ namespace SabreTools.Helper
} }
// Now go through and sort all of the lists // Now go through and sort all of the lists
foreach (string key in sortable.Keys) List<string> keys = sortable.Keys.ToList();
foreach (string key in keys)
{ {
RomTools.Sort(sortable[key], norename); List<Rom> sortedlist = sortable[key];
RomTools.Sort(ref sortedlist, norename);
sortable[key] = sortedlist;
} }
// Output the count if told to // Output the count if told to

View File

@@ -224,7 +224,7 @@ namespace SabreTools.Helper
/// <param name="roms">List of RomData objects representing the roms to be sorted</param> /// <param name="roms">List of RomData objects representing the roms to be sorted</param>
/// <param name="norename">True if files are not renamed, false otherwise</param> /// <param name="norename">True if files are not renamed, false otherwise</param>
/// <returns>True if it sorted correctly, false otherwise</returns> /// <returns>True if it sorted correctly, false otherwise</returns>
public static bool Sort(List<Rom> roms, bool norename) public static bool Sort(ref List<Rom> roms, bool norename)
{ {
try try
{ {