Beispiel #1
0
        private static void Main(string[] args)
        {
            // dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true
            try
            {
                var parser = new Parser(with => with.HelpWriter = null);
                parserResult = parser.ParseArguments <InjectorOptions>(args);
                parserResult
                .WithParsed(
                    opts =>
                {
                    Options = opts;
                    logger.Debug($"args: {string.Join(' ', args)}");
                    opts.UpdateFromFile();
                    opts.Log();
                    opts.Validate();

                    var injector = new Injector(opts);
                    injector.Inject();
                }
                    )
                .WithNotParsed(errs => DisplayHelp(parserResult, errs));
            }
            catch (Exception ex)
            {
                HandleException("An unknown error occurred. See log for details", ex);
            }

            WaitForUserInput();
        }
Beispiel #2
0
 public Injector(InjectorOptions opts)
 {
     this.opts = opts;
 }