public RunContext Get()
        {
            RunConfig config = _configSrc.Load();

            if (config.IsUndefined())
            {
                throw new RunConfigUndefinedException();
            }

            string connectionStr = _hostCtx.GetCurrentConnectionString();
            SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectionStr);

            return(new RunContext()
            {
                Config = config,
                ConnectionString = builder,
            });
        }
Ejemplo n.º 2
0
        public string Execute()
        {
            try
            {
                RunContext context = _contextProvider.Get();
                RunConfig  config  = context.Config;
                string     args    = _paramsProcessor.Compose(config.RunArgs, context.ConnectionString);
                _process.Start(config.RunTool, args);
            }
            catch (RunConfigUndefinedException)
            {
                return("Undefined");
            }
            catch (ConnectionInfoException)
            {
                return("Insufficient connection info");
            }
            catch (Exception)
            {
                throw;
            }

            return("Tool runned");
        }
 public void Save(RunConfig cfg)
 {
     Registry.SetValue(_masterKey, RunToolKey, cfg.RunTool ?? String.Empty);
     Registry.SetValue(_masterKey, RunArgsKey, cfg.RunArgs ?? String.Empty);
 }