Files
TwoFour/Program.cs

59 lines
1.9 KiB
C#
Raw Permalink Normal View History

2017-04-17 21:11:23 -07:00
using System;
namespace TwoFour
{
2020-08-18 12:58:41 -07:00
public class Program
{
public static void Main(string[] args)
{
2020-08-18 13:33:25 -07:00
// If we don't have the right number of inputs, show help and exit
2020-08-18 13:07:59 -07:00
if (args.Length < 2)
2020-08-18 12:58:41 -07:00
{
2020-08-18 13:07:59 -07:00
Console.WriteLine("At least 2 arguments are required");
2020-08-18 12:58:41 -07:00
DisplayHelp();
return;
}
2020-08-18 13:33:25 -07:00
// Get rebuild depth from first arg
int depth;
if (args[0] == "rvx" || args[0] == "romvaultx" || args[0] == "romroot")
depth = 2;
else if (args[0] == "romba" || args[0] == "depot")
depth = 4;
else if (!int.TryParse(args[0], out depth))
depth = -1;
2020-08-18 12:58:41 -07:00
// If neither matched, show help and exit
2020-08-18 13:33:25 -07:00
if (depth < 0)
2020-08-18 12:58:41 -07:00
{
2020-08-18 13:33:25 -07:00
Console.WriteLine($"{args[0]} is not a valid depth");
2020-08-18 12:58:41 -07:00
DisplayHelp();
return;
}
2020-08-18 13:33:25 -07:00
// Process each directory from remaining args
2020-08-18 13:07:59 -07:00
for (int i = 1; i < args.Length; i++)
2020-08-18 12:58:41 -07:00
{
2020-08-18 13:33:25 -07:00
Processor processor = new Processor(args[i], depth);
if (!processor.ProcessFolder())
2020-08-18 13:07:59 -07:00
{
DisplayHelp();
return;
}
}
2020-08-18 12:58:41 -07:00
}
/// <summary>
/// Display the help text
/// </summary>
private static void DisplayHelp()
{
2020-08-18 13:07:59 -07:00
Console.WriteLine("Usage: TwoFour.exe [mode] [path\\to\\folder] ...");
2020-08-18 12:58:41 -07:00
Console.WriteLine();
2020-08-18 13:33:25 -07:00
Console.WriteLine("Special modes for 2-deep: rvx, romvaultx, romroot");
Console.WriteLine("Special modes for 4-deep: romba, depot");
Console.WriteLine("All other positive numbers are allowed");
2020-08-18 12:58:41 -07:00
}
}
2017-04-17 21:11:23 -07:00
}