From c0060bc68187ea1353063322327026d457bff912 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Thu, 20 Jul 2017 22:43:13 +0200 Subject: [PATCH] Update options to the new v2 API. --- src/Generator.Rewrite/Options.cs | 10 ++-------- src/Generator.Rewrite/Program.cs | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/Generator.Rewrite/Options.cs b/src/Generator.Rewrite/Options.cs index 8a122aa..6e243f9 100644 --- a/src/Generator.Rewrite/Options.cs +++ b/src/Generator.Rewrite/Options.cs @@ -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.")] 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.")] public bool EnableDebugCalls { get; set; } - [Option("dllimport", DefaultValue = false, + [Option("dllimport", Default = false, HelpText = "Force native calls to use DllImport instead of GetProcAddress.")] public bool UseDLLImport { get; set; } - - [HelpOption] - public string GetUsage() - { - return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current)); - } } } \ No newline at end of file diff --git a/src/Generator.Rewrite/Program.cs b/src/Generator.Rewrite/Program.cs index e161a98..459198d 100644 --- a/src/Generator.Rewrite/Program.cs +++ b/src/Generator.Rewrite/Program.cs @@ -29,14 +29,13 @@ namespace OpenTK.Rewrite // with the s IL instructions. internal class Program { - private static readonly Options Options = new Options(); + private static Options Options; private static void Main(string[] args) { - if (!Parser.Default.ParseArguments(args, Options)) - { - return; - } + Parser.Default.ParseArguments(args) + .WithParsed(result => Options = result) + .WithNotParsed(error => Environment.Exit(-1)); // Argument error checking if (!File.Exists(Options.TargetAssembly)) -- 2.7.4