Пример #1
0
 public override void Setup(BizTalkManager manager, Uri moxyUri)
 {
     if (SetupAction == null)
     {
         throw new InvalidOperationException("The Setup action has not been configured for this Send Stop.");
     }
     SetupAction.Invoke(manager, moxyUri);
     base.Setup(manager, moxyUri);
 }
 public static void IsGet(this ControlComponent component, string pathRegex, MiddlewareFunc middlewareFunc, SetupAction setup = null) {
     component.When(BuildGetFilter(pathRegex), middlewareFunc, setup);
 }
Пример #3
0
 public IPipeline Use(MiddlewareFunc middleware, SetupAction setup = null) {
     _components.Add(new DelegateComponent(middleware, setup));
     return this;
 }
Пример #4
0
 public void Use(AppFunc app, SetupAction setup = null) {
     _components.Add(new DelegateComponent((env, next) => app(env), setup));
 }
Пример #5
0
 static void ActionAdd(SetupAction action)
 {
     _actions.Insert(0, action);
 }
Пример #6
0
 public MiddleWareDelegateComponent(MiddlewareFunc middleware, SetupAction setup = null)
 {
     _middleware = middleware;
     _setup      = setup;
 }
Пример #7
0
 public void When(Func <Env, bool> shouldHandle, MiddlewareFunc middlewareFunc, SetupAction setup = null)
 {
     When(shouldHandle, new DelegateComponent(middlewareFunc, setup));
 }
Пример #8
0
 public void When(Func <Env, bool> shouldHandle, AppFunc appFunc, SetupAction setup = null)
 {
     When(shouldHandle, new DelegateComponent((env, _) => appFunc(env), setup));
 }
Пример #9
0
 public void Use(AppFunc app, SetupAction setup = null)
 {
     _components.Add(new MiddleWareDelegateComponent((env, next) => app(env), setup));
 }
Пример #10
0
 public IPipeline Use(MiddlewareFunc middleware, SetupAction setup = null)
 {
     _components.Add(new MiddleWareDelegateComponent(middleware, setup));
     return(this);
 }
 public static void IsGet(this ControlComponent component, string pathRegex, MiddlewareFunc middlewareFunc, SetupAction setup = null)
 {
     component.When(BuildGetFilter(pathRegex), middlewareFunc, setup);
 }
 public void When(Func<Env, bool> shouldHandle, MiddlewareFunc middlewareFunc, SetupAction setup = null) {
     When(shouldHandle, new DelegateComponent(middlewareFunc, setup));
 }
 public void When(Func<Env, bool> shouldHandle, AppFunc appFunc, SetupAction setup = null) {
     When(shouldHandle, new DelegateComponent((env, _) => appFunc(env), setup));
 }
Пример #14
0
        static void Main(string[] args)
        {
            var app = new CommandLineApplication();

            app.Name        = "taide";
            app.Description = ".NET Core console app with argument parsing.";
            app.HelpOption(helpValues);

            var basicOption = app.Option("-o|--option<optionvalue>",
                                         "Some option value",
                                         CommandOptionType.SingleValue);

            app.OnExecute(() => {
                if (basicOption.HasValue())
                {
                    Console.WriteLine("Option was selected, value: {0}", basicOption.Value());
                }
                else
                {
                    app.ShowHint();
                }

                return(0);
            });

            app.Command("setup", (command) => {
                command.Description = "Creates commonly used variables and modules in Terraform project.";
                command.HelpOption(helpValues);
                command.OnExecute(() => {
                    var action = new SetupAction();
                    action.Execute();
                    return(0);
                });
            });

            app.Command("create", (command) => {
                command.Description = "Creates a new Terraform project folder in the current directory.";
                command.HelpOption(helpValues);
                command.OnExecute(() => {
                    var action = new CreateAction();
                    action.Execute();
                    return(0);
                });
            });

            app.Command("module", (command) => {
                command.Description = "";
                command.HelpOption(helpValues);
                command.OnExecute(() => {
                    var action = new ModuleAction();
                    action.Execute();
                    return(0);
                });
            });

            app.Command("variable", (command) => {
                command.Description = "";
                command.HelpOption(helpValues);
                command.OnExecute(() => {
                    var action = new VariableAction();
                    action.Execute();
                    return(0);
                });
            });

            app.Command("test", (command) => {
                command.Description = "";
                command.HelpOption(helpValues);
                command.OnExecute(() => {
                    var action = new TestAction();
                    action.Execute();
                    return(0);
                });
            });

            app.Execute(args);
            #if DEBUG
            Console.WriteLine("Press any key to close...");
            Console.ReadKey();
            #endif
        }
 public DelegateComponent(MiddlewareFunc middleware, SetupAction setup = null) {
     _middleware = middleware;
     _setup = setup;
 }