mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move help to a central location; update help
This commit is contained in:
@@ -102,7 +102,7 @@ namespace SabreTools
|
|||||||
// If more than one switch is enabled or help is set, show the help screen
|
// If more than one switch is enabled or help is set, show the help screen
|
||||||
if (help || !(import ^ generate ^ listsys ^ listsrc ^ genall ^ add ^ rem ^ convertRV ^ convertXml))
|
if (help || !(import ^ generate ^ listsys ^ listsrc ^ genall ^ add ^ rem ^ convertRV ^ convertXml))
|
||||||
{
|
{
|
||||||
Help();
|
Build.Help();
|
||||||
logger.Close();
|
logger.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Help();
|
Build.Help();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Help();
|
Build.Help();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ Make a selection:
|
|||||||
switch (selection)
|
switch (selection)
|
||||||
{
|
{
|
||||||
case "1":
|
case "1":
|
||||||
Help();
|
Build.Help();
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
ImportMenu();
|
ImportMenu();
|
||||||
@@ -282,56 +282,6 @@ Make a selection:
|
|||||||
Console.WriteLine("Thank you for using DATabase!");
|
Console.WriteLine("Thank you for using DATabase!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Show the help dialog
|
|
||||||
/// </summary>
|
|
||||||
private static void Help()
|
|
||||||
{
|
|
||||||
Console.Clear();
|
|
||||||
Console.Write(@"
|
|
||||||
DATabase - Import and Generate DAT files
|
|
||||||
-----------------------------------------
|
|
||||||
Usage: DATabase [option] [filename|dirname|<system=sy,...> <source=so,...>]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-h, -?, --help Show this help
|
|
||||||
-i, --import Start tool in import mode
|
|
||||||
A filename or folder is required to run
|
|
||||||
-g, --generate Start tool in generate mode
|
|
||||||
system=sy,... List of system IDs
|
|
||||||
source=so,... List of source IDs
|
|
||||||
out=dir Output directory
|
|
||||||
-nr, --no-rename Don't auto-rename games
|
|
||||||
-old, --romvault Produce a DAT in RV format
|
|
||||||
-ga, --generate-all Start tool in generate all mode
|
|
||||||
-lso, --list-sources List all sources (id <= name)
|
|
||||||
-lsy, --list-systems List all systems (id <= name)
|
|
||||||
-cr, --convert-rv Convert an XML DAT to RV
|
|
||||||
-cx, --convert-xml Convert a RV DAT to XML
|
|
||||||
Both converters require a filename or folder
|
|
||||||
-l, --log Enable logging of program output
|
|
||||||
");
|
|
||||||
|
|
||||||
Console.Write("\nPress any key to continue...");
|
|
||||||
Console.ReadKey();
|
|
||||||
Console.Write(@"
|
|
||||||
Database Options:
|
|
||||||
-a, --add Add a new system or source to the database
|
|
||||||
manu=mn Manufacturer name (system only)
|
|
||||||
system=sy System name (system only)
|
|
||||||
source=sr Source name (source only)
|
|
||||||
url=ul URL (source only)
|
|
||||||
-r, --remove Remove a system or source from the database
|
|
||||||
system=sy System ID
|
|
||||||
source=so Source ID
|
|
||||||
|
|
||||||
Filenames and directories can't start with '-', 'system=', or 'source='
|
|
||||||
unless prefixed by 'input='");
|
|
||||||
Console.Write("\nPress any key to continue...");
|
|
||||||
Console.ReadKey();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show the text-based import menu
|
/// Show the text-based import menu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace DatSplit
|
|||||||
// If we don't have arguments, show help
|
// If we don't have arguments, show help
|
||||||
if (args.Length == 0 && args.Length != 3)
|
if (args.Length == 0 && args.Length != 3)
|
||||||
{
|
{
|
||||||
Help();
|
Build.Help();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,10 +158,5 @@ namespace DatSplit
|
|||||||
string outPathB = Path.GetFileNameWithoutExtension(_filename) + _extB + Path.GetExtension(_filename);
|
string outPathB = Path.GetFileNameWithoutExtension(_filename) + _extB + Path.GetExtension(_filename);
|
||||||
File.WriteAllText(outPathB, Style.Beautify(outDocB), Encoding.UTF8);
|
File.WriteAllText(outPathB, Style.Beautify(outDocB), Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Help()
|
|
||||||
{
|
|
||||||
Console.WriteLine("DatSplit.exe <filename> <ext> <ext>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,6 @@ namespace SabreTools
|
|||||||
private static string _dbName = "Headerer.sqlite";
|
private static string _dbName = "Headerer.sqlite";
|
||||||
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
|
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
|
||||||
private static Dictionary<string, int> types;
|
private static Dictionary<string, int> types;
|
||||||
private static string help = @"Deheader - Remove headers from roms
|
|
||||||
-----------------------------------------
|
|
||||||
Usage: Deheader [option] [filename|dirname]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-e Detect and remove mode
|
|
||||||
-r Restore header to file based on SHA-1";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start deheader operation with supplied parameters
|
/// Start deheader operation with supplied parameters
|
||||||
@@ -48,7 +41,7 @@ Options:
|
|||||||
|
|
||||||
if (args.Length == 0 || args.Length > 2)
|
if (args.Length == 0 || args.Length > 2)
|
||||||
{
|
{
|
||||||
Console.WriteLine(help);
|
Build.Help();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +88,7 @@ Options:
|
|||||||
// Else, show that help text
|
// Else, show that help text
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine(help);
|
Build.Help();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -119,7 +112,7 @@ Options:
|
|||||||
// Else, show that help text
|
// Else, show that help text
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine(help);
|
Build.Help();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
namespace SabreTools.Helper
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace SabreTools.Helper
|
||||||
{
|
{
|
||||||
public class Build
|
public class Build
|
||||||
{
|
{
|
||||||
@@ -6,5 +10,90 @@
|
|||||||
{
|
{
|
||||||
get { return "0.4.0.0"; }
|
get { return "0.4.0.0"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show the help dialog for a given class
|
||||||
|
/// </summary>
|
||||||
|
public static void Help()
|
||||||
|
{
|
||||||
|
//http://stackoverflow.com/questions/14849367/how-to-determine-calling-method-and-class-name
|
||||||
|
StackTrace st = new StackTrace();
|
||||||
|
string className = st.GetFrame(1).GetMethod().ReflectedType.Name;
|
||||||
|
|
||||||
|
switch (className)
|
||||||
|
{
|
||||||
|
case "DATabase":
|
||||||
|
Console.Clear();
|
||||||
|
Console.Write(@"
|
||||||
|
DATabase - Import and Generate DAT files
|
||||||
|
-----------------------------------------
|
||||||
|
Usage: DATabase [option] [filename|dirname|<system=sy,...> <source=so,...>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, -?, --help Show this help
|
||||||
|
-i, --import Start tool in import mode
|
||||||
|
A filename or folder is required to run
|
||||||
|
-g, --generate Start tool in generate mode
|
||||||
|
system=sy,... List of system IDs
|
||||||
|
source=so,... List of source IDs
|
||||||
|
out=dir Output directory
|
||||||
|
-nr, --no-rename Don't auto-rename games
|
||||||
|
-old, --romvault Produce a DAT in RV format
|
||||||
|
-ga, --generate-all Start tool in generate all mode
|
||||||
|
-lso, --list-sources List all sources (id <= name)
|
||||||
|
-lsy, --list-systems List all systems (id <= name)
|
||||||
|
-cr, --convert-rv Convert an XML DAT to RV
|
||||||
|
-cx, --convert-xml Convert a RV DAT to XML
|
||||||
|
Both converters require a filename or folder
|
||||||
|
-l, --log Enable logging of program output
|
||||||
|
");
|
||||||
|
|
||||||
|
Console.Write("\nPress any key to continue...");
|
||||||
|
Console.ReadKey();
|
||||||
|
Console.Write(@"
|
||||||
|
Database Options:
|
||||||
|
-a, --add Add a new system or source to the database
|
||||||
|
manu=mn Manufacturer name (system only)
|
||||||
|
system=sy System name (system only)
|
||||||
|
source=sr Source name (source only)
|
||||||
|
url=ul URL (source only)
|
||||||
|
-r, --remove Remove a system or source from the database
|
||||||
|
system=sy System ID
|
||||||
|
source=so Source ID
|
||||||
|
|
||||||
|
Filenames and directories can't start with '-', 'system=', or 'source='
|
||||||
|
unless prefixed by 'input='");
|
||||||
|
Console.Write("\nPress any key to continue...");
|
||||||
|
Console.ReadKey();
|
||||||
|
break;
|
||||||
|
case "DatSplit":
|
||||||
|
Console.WriteLine(@"DatSplit - Split DAT files by file extension
|
||||||
|
-----------------------------------------
|
||||||
|
Usage: DatSplit.exe <filename> <ext> <ext>");
|
||||||
|
break;
|
||||||
|
case "Headerer":
|
||||||
|
Console.WriteLine(@"Headerer - Remove and restore rom headers
|
||||||
|
-----------------------------------------
|
||||||
|
Usage: Headerer [option] [filename|dirname]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-e Detect and remove mode
|
||||||
|
-r Restore header to file based on SHA-1");
|
||||||
|
break;
|
||||||
|
case "SingleGame":
|
||||||
|
Console.WriteLine(@"SingleGame - Process DATs for use in server environments
|
||||||
|
-----------------------------------------
|
||||||
|
Usage: SingleGame.exe <filename> [-r=rootdir|-n]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-r=rootdir Set the directory name for path size
|
||||||
|
-n Disable single-game mode
|
||||||
|
");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.Write("This is the default help output");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
if (args.Length == 0)
|
if (args.Length == 0)
|
||||||
{
|
{
|
||||||
Help();
|
Build.Help();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,13 +152,5 @@ namespace SabreTools
|
|||||||
string outPath = Path.GetFileNameWithoutExtension(_filename) + ".new" + Path.GetExtension(_filename);
|
string outPath = Path.GetFileNameWithoutExtension(_filename) + ".new" + Path.GetExtension(_filename);
|
||||||
File.WriteAllText(outPath, Style.Beautify(tempDoc));
|
File.WriteAllText(outPath, Style.Beautify(tempDoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Help()
|
|
||||||
{
|
|
||||||
Console.WriteLine(@"SingleGame.exe <filename> [-r=rootdir|-n]
|
|
||||||
-r=rootdir Set the directory name for path size
|
|
||||||
-n Disable single-game mode
|
|
||||||
");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user