Update options to the new v2 API.

This commit is contained in:
Jarl Gullberg 2017-07-20 22:43:13 +02:00
parent 3919e5f14f
commit c0060bc681
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
2 changed files with 6 additions and 13 deletions

View file

@ -13,18 +13,12 @@ namespace OpenTK.Rewrite
HelpText = "The path to the strong name key which should be used to sign or resign the assembly.")] HelpText = "The path to the strong name key which should be used to sign or resign the assembly.")]
public string StrongNameKey { get; set; } public string StrongNameKey { get; set; }
[Option('d', "debug", DefaultValue = false, [Option('d', "debug", Default = false,
HelpText = "Enable calls to GL.GetError(), wrapped around each native call.")] HelpText = "Enable calls to GL.GetError(), wrapped around each native call.")]
public bool EnableDebugCalls { get; set; } public bool EnableDebugCalls { get; set; }
[Option("dllimport", DefaultValue = false, [Option("dllimport", Default = false,
HelpText = "Force native calls to use DllImport instead of GetProcAddress.")] HelpText = "Force native calls to use DllImport instead of GetProcAddress.")]
public bool UseDLLImport { get; set; } public bool UseDLLImport { get; set; }
[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current));
}
} }
} }

View file

@ -29,14 +29,13 @@ namespace OpenTK.Rewrite
// with the s IL instructions. // with the s IL instructions.
internal class Program internal class Program
{ {
private static readonly Options Options = new Options(); private static Options Options;
private static void Main(string[] args) private static void Main(string[] args)
{ {
if (!Parser.Default.ParseArguments(args, Options)) Parser.Default.ParseArguments<Options>(args)
{ .WithParsed(result => Options = result)
return; .WithNotParsed(error => Environment.Exit(-1));
}
// Argument error checking // Argument error checking
if (!File.Exists(Options.TargetAssembly)) if (!File.Exists(Options.TargetAssembly))