Get framework for adding SuperDAT functionality

This commit is contained in:
Matt Nadareski
2016-04-17 19:26:19 -07:00
parent 519c8a0e3c
commit 1e7b0b7408
2 changed files with 49 additions and 24 deletions

View File

@@ -17,6 +17,7 @@ namespace SabreTools
/// <summary>
/// Create a DAT file from a specified file, directory, or set thereof
/// </summary>
/// <remarks>Add SuperDAT functionality</remarks>
public class DATFromDir
{
// Path-related variables
@@ -34,6 +35,7 @@ namespace SabreTools
private static bool _allfiles;
private static bool _old;
private static bool _log;
private static bool _superDat;
// User specified strings
private static string _name;
@@ -56,7 +58,7 @@ namespace SabreTools
Console.Title = "DATFromDir " + Build.Version;
// 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 = "";
List<string> inputs = new List<string>();
foreach (string arg in args)
@@ -97,6 +99,10 @@ namespace SabreTools
case "--log":
_log = true;
break;
case "-sd":
case "--superdat":
_superDat = true;
break;
default:
if (arg.StartsWith("-n=") || arg.StartsWith("--name="))
{
@@ -152,6 +158,23 @@ namespace SabreTools
// Create an output array for all found items
_roms = new 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)
{
}
else
{
// Loop over each of the found paths, if any
foreach (string path in inputs)
{
@@ -180,6 +203,7 @@ namespace SabreTools
_logger.Error(path + " is not a valid input!");
}
}
}
// If we found nothing (error state), show the help and exit
if (_roms.Count == 0)

View File

@@ -120,7 +120,8 @@ Options:
-c=, --cat= Set the category of the DAT
-v=, --version= Set the version 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;
default:
Console.Write("This is the default help output");