mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Make sure that DATs at every depth get properly written out
This commit is contained in:
@@ -5234,8 +5234,23 @@ namespace SabreTools.Helper.Dats
|
|||||||
DatFile tempDat = (DatFile)CloneHeader();
|
DatFile tempDat = (DatFile)CloneHeader();
|
||||||
tempDat.Name = null;
|
tempDat.Name = null;
|
||||||
|
|
||||||
|
// Sort the input keys
|
||||||
|
List<string> keys = Files.Keys.ToList();
|
||||||
|
keys.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
NaturalComparer nc = new NaturalComparer();
|
||||||
|
int adeep = a.Count(c => c == Path.AltDirectorySeparatorChar || c == Path.DirectorySeparatorChar);
|
||||||
|
int bdeep = b.Count(c => c == Path.AltDirectorySeparatorChar || c == Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
|
if (adeep == bdeep)
|
||||||
|
{
|
||||||
|
return nc.Compare(a, b);
|
||||||
|
}
|
||||||
|
return adeep - bdeep;
|
||||||
|
});
|
||||||
|
|
||||||
// Then, we loop over the games
|
// Then, we loop over the games
|
||||||
foreach (string key in Files.Keys)
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
// Here, the key is the name of the game to be used for comparison
|
// Here, the key is the name of the game to be used for comparison
|
||||||
if (tempDat.Name != null && tempDat.Name != Path.GetDirectoryName(key))
|
if (tempDat.Name != null && tempDat.Name != Path.GetDirectoryName(key))
|
||||||
|
|||||||
Reference in New Issue
Block a user