You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using McMaster.Extensions.CommandLineUtils;
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
namespace UsmToolkit
|
|
|
|
{
|
|
|
|
[Command("UsmToolkit")]
|
|
|
|
[VersionOptionFromMember("--version", MemberName = nameof(GetVersion))]
|
|
|
|
[Subcommand(typeof(ExtractCommand), typeof(ConvertCommand))]
|
|
|
|
class Program
|
|
|
|
{
|
|
|
|
static int Main(string[] args)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return CommandLineApplication.Execute<Program>(args);
|
|
|
|
}
|
|
|
|
catch (FileNotFoundException e)
|
|
|
|
{
|
|
|
|
Console.WriteLine($"The file {e.FileName} cannot be found. The program will now exit.");
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Console.WriteLine($"FATAL ERROR: {e.Message}\n{e.StackTrace}");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int OnExecute(CommandLineApplication app)
|
|
|
|
{
|
|
|
|
app.ShowHelp();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static string GetVersion()
|
|
|
|
=> typeof(Program).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
|
|
|
}
|
|
|
|
}
|