Ejemplo n.º 1
0
        static int MainCore(string[] args)
        {
            var app = new CommandLineApplication();

            app.Name        = nameof(RelayUtil);
            app.Description = "Azure Relay Utility Commands";
            RelayCommands.CommonSetup(app);

            try
            {
                app.OnExecute(() =>
                {
                    app.ShowHelp();
                    return(0);
                });

                DiagnosticCommands.ConfigureCommands(app);
                WcfRelayCommands.ConfigureCommands(app);
                HybridConnectionCommands.ConfigureCommands(app);
                SharedAccessSignatureCommands.ConfigureCommands(app);

                return(app.Execute(args));
            }
            catch (Exception exception)
            {
                RelayTraceSource.TraceException(exception);
                return(exception.HResult);
            }
        }
Ejemplo n.º 2
0
        public static CommandLineApplication RelayCommand(this CommandLineApplication application, string name, Action <CommandLineApplication> configure, bool throwOnUnexpectedArg = true)
        {
            Action <CommandLineApplication> outerConfigure = (app) =>
            {
                RelayCommands.CommonSetup(app);
                configure(app);
            };

            return(application.Command(name, outerConfigure, throwOnUnexpectedArg));
        }