mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Get framework for adding SuperDAT functionality
This commit is contained in:
@@ -17,6 +17,7 @@ namespace SabreTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a DAT file from a specified file, directory, or set thereof
|
/// Create a DAT file from a specified file, directory, or set thereof
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Add SuperDAT functionality</remarks>
|
||||||
public class DATFromDir
|
public class DATFromDir
|
||||||
{
|
{
|
||||||
// Path-related variables
|
// Path-related variables
|
||||||
@@ -34,6 +35,7 @@ namespace SabreTools
|
|||||||
private static bool _allfiles;
|
private static bool _allfiles;
|
||||||
private static bool _old;
|
private static bool _old;
|
||||||
private static bool _log;
|
private static bool _log;
|
||||||
|
private static bool _superDat;
|
||||||
|
|
||||||
// User specified strings
|
// User specified strings
|
||||||
private static string _name;
|
private static string _name;
|
||||||
@@ -56,7 +58,7 @@ namespace SabreTools
|
|||||||
Console.Title = "DATFromDir " + Build.Version;
|
Console.Title = "DATFromDir " + Build.Version;
|
||||||
|
|
||||||
// First things first, take care of all of the arguments that this could have
|
// First things first, take care of all of the arguments that this could have
|
||||||
_noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false; _log = false; ;
|
_noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false; _log = false; _superDat = false;
|
||||||
_name = ""; _desc = ""; _cat = ""; _version = ""; _author = ""; _basePath = "";
|
_name = ""; _desc = ""; _cat = ""; _version = ""; _author = ""; _basePath = "";
|
||||||
List<string> inputs = new List<string>();
|
List<string> inputs = new List<string>();
|
||||||
foreach (string arg in args)
|
foreach (string arg in args)
|
||||||
@@ -97,6 +99,10 @@ namespace SabreTools
|
|||||||
case "--log":
|
case "--log":
|
||||||
_log = true;
|
_log = true;
|
||||||
break;
|
break;
|
||||||
|
case "-sd":
|
||||||
|
case "--superdat":
|
||||||
|
_superDat = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (arg.StartsWith("-n=") || arg.StartsWith("--name="))
|
if (arg.StartsWith("-n=") || arg.StartsWith("--name="))
|
||||||
{
|
{
|
||||||
@@ -152,32 +158,50 @@ namespace SabreTools
|
|||||||
// Create an output array for all found items
|
// Create an output array for all found items
|
||||||
_roms = new List<RomData>();
|
_roms = new List<RomData>();
|
||||||
|
|
||||||
// Loop over each of the found paths, if any
|
/*
|
||||||
foreach (string path in inputs)
|
For clarity, here is the process for SuperDAT:
|
||||||
{
|
1) Check to see if the input is a directory
|
||||||
// Set local paths and vars
|
2) If it is, loop through and get ONLY the directories
|
||||||
_tempDir = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "temp" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.DirectorySeparatorChar;
|
3) Treat each subdirectory like a base path
|
||||||
|
4) Process each subdirectory like a normal one
|
||||||
_basePath = (File.Exists(path) ? path : path + Path.DirectorySeparatorChar);
|
5) Prefix any added game names with the parent directory name
|
||||||
_basePath = Path.GetFullPath(_basePath);
|
6) Process like normal
|
||||||
|
*/
|
||||||
|
|
||||||
// This is where the main loop would go
|
// If we're in SuperDAT mode, we have to treat it separately
|
||||||
if (File.Exists(_basePath))
|
if (_superDat)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Loop over each of the found paths, if any
|
||||||
|
foreach (string path in inputs)
|
||||||
{
|
{
|
||||||
ProcessFile(_basePath);
|
// Set local paths and vars
|
||||||
}
|
_tempDir = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "temp" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.DirectorySeparatorChar;
|
||||||
else if (Directory.Exists(_basePath))
|
|
||||||
{
|
_basePath = (File.Exists(path) ? path : path + Path.DirectorySeparatorChar);
|
||||||
_logger.Log("Folder found: " + _basePath);
|
_basePath = Path.GetFullPath(_basePath);
|
||||||
foreach (string item in Directory.EnumerateFiles(_basePath, "*", SearchOption.AllDirectories))
|
|
||||||
|
// This is where the main loop would go
|
||||||
|
if (File.Exists(_basePath))
|
||||||
{
|
{
|
||||||
ProcessFile(item);
|
ProcessFile(_basePath);
|
||||||
|
}
|
||||||
|
else if (Directory.Exists(_basePath))
|
||||||
|
{
|
||||||
|
_logger.Log("Folder found: " + _basePath);
|
||||||
|
foreach (string item in Directory.EnumerateFiles(_basePath, "*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
ProcessFile(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If this somehow skips past the original sensors
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Error(path + " is not a valid input!");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// If this somehow skips past the original sensors
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Error(path + " is not a valid input!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ Options:
|
|||||||
-c=, --cat= Set the category of the DAT
|
-c=, --cat= Set the category of the DAT
|
||||||
-v=, --version= Set the version of the DAT
|
-v=, --version= Set the version of the DAT
|
||||||
-a=, --author= Set the author of the DAT
|
-a=, --author= Set the author of the DAT
|
||||||
-l, --log Enable log to file");
|
-l, --log Enable log to file
|
||||||
|
-sd, --superdat Enable SuperDAT creation");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Console.Write("This is the default help output");
|
Console.Write("This is the default help output");
|
||||||
|
|||||||
Reference in New Issue
Block a user