Properly implement SuperDAT functionality

This commit is contained in:
Matt Nadareski
2016-05-17 10:31:57 -07:00
parent 0ae52b9435
commit 17a2480f03

View File

@@ -217,24 +217,6 @@ namespace SabreTools
// Create an output dictionary for all found items
_dict = new Dictionary<string, List<RomData>>();
/*
For clarity, here is the process for SuperDAT:
1) Check to see if the input is a directory
2) If it is, loop through and get ONLY the directories
3) Treat each subdirectory like a base path
4) Process each subdirectory like a normal one
5) Prefix any added game names with the parent directory name
6) Process like normal
*/
// If we're in SuperDAT mode, we have to treat it separately
if (_superDat)
{
_logger.Error("SuperDAT functionality not implemented yet!");
return false;
}
else
{
// Loop over each of the found paths, if any
foreach (string path in _inputs)
{
@@ -280,7 +262,6 @@ namespace SabreTools
_logger.Error(path + " is not a valid input!");
}
}
}
// If we found nothing (error state), exit
if (_dict.Count == 0)
@@ -305,6 +286,26 @@ namespace SabreTools
}
}
_name = (_name == "" ? "Default" : _name);
// If we're in a superdat, append the folder name to all game names
if (_superDat)
{
List<string> keys = _dict.Keys.ToList();
foreach (string key in keys)
{
List<RomData> newroms = new List<RomData>();
foreach (RomData rom in _dict[key])
{
RomData newrom = rom;
newrom.Game = _name + Path.DirectorySeparatorChar + newrom.Game;
newroms.Add(newrom);
}
_dict[key] = newroms;
}
_name = _name += " - SuperDAT";
}
_desc = (_desc == "" ? _name + (_bare ? "" : " (" + _date + ")") : _desc);
DatData datdata = new DatData