Example #1
0
        /// <summary>
        /// Creates the specific IUServiceController of the 'create_instance' IU pattern.
        /// </summary>
        /// <param name="exchangeInfo">IUServiceController reference.</param>
        /// <returns>Specific IUServiceController of the 'create_instance' IU pattern.</returns>
        public static IUServiceController Service_create_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController)
        {
            string[]            lAgentsService = { Agents.Administrador };
            IUServiceContext    lContext       = new IUServiceContext(exchangeInfo, "Revision", "create_instance", "SIU_create_instance");
            IUServiceController lController    = new IUServiceController("create_instance", "New", "Clas_1348178542592347Ser_1_Alias", lAgentsService, "Revision", "create_instance", lContext, null);

            // This controller is an InboundArgument controller.
            lController.IsOutboundArgumentController = false;


            #region Inbound arguments
            IArguments InboundArguments = lController.InputFields;
            // Argument p_atrid_RevisarAeronave.
            InboundArguments.Add(new ArgumentDVController("p_atrid_RevisarAeronave", "id_RevisarAeronave", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_1_Alias", ModelType.Autonumeric, 0, false, null, lController));
            // Argument p_atrFechaRevision.
            InboundArguments.Add(new ArgumentDVController("p_atrFechaRevision", "FechaRevision", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_3_Alias", ModelType.Date, 0, false, null, lController));
            // Argument p_atrNombreRevisor.
            InboundArguments.Add(new ArgumentDVController("p_atrNombreRevisor", "NombreRevisor", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_4_Alias", ModelType.String, 100, false, null, lController));
            // Argument p_atrId_Aeronave.
            InboundArguments.Add(new ArgumentDVController("p_atrId_Aeronave", "Id_Aeronave", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_5_Alias", ModelType.String, 100, false, null, lController));
            #endregion Inbound arguments

            #region Outbound arguments
            // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null.
            lController.OutboundArgumentsScenario = null;
            #endregion Outbound arguments


            return(lController);
        }
Example #2
0
        /// <summary>
        /// Creates an instance and sets it up using <paramref name="arguments"/>.
        /// </summary>
        /// <param name="arguments">The arguments that define how this instance behaves. Only
        /// <see cref="IArguments.OutputDirectory"/> and <see cref="IArguments.SpecifiedOutputDirectory"/> are
        /// consumed in the constructor.</param>
        public DataLoaderExecutor(IArguments arguments)
        {
            _arguments = arguments;
            switch (arguments.OutputDirectory)
            {
            case OutputDirectory.AppData:
                _savePath = AppData.GetFolder();
                break;

            case OutputDirectory.Current:
                _savePath = Directory.GetCurrentDirectory();
                break;

            case OutputDirectory.Specified:
                _savePath = arguments.SpecifiedOutputDirectory;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Log.Info("Using output directory {0}.", _savePath);
            _savePath = Path.Combine(_savePath, "Data");

            _loaderDefinitions.ForEach(l => l.DataLoader.HttpClient = _httpClient);

            _httpClient.DefaultRequestHeaders.Add("User-Agent",
                                                  "PoESkillTree UpdateDB (https://github.com/PoESkillTree/PoESkillTree/tree/master/UpdateDB)");
        }
Example #3
0
        /// <summary>
        /// Creates the specific IUServiceController of the 'delete_instance' IU pattern.
        /// </summary>
        /// <param name="exchangeInfo">IUServiceController reference.</param>
        /// <returns>Specific IUServiceController of the 'delete_instance' IU pattern.</returns>
        public static IUServiceController Service_delete_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController)
        {
            string[]            lAgentsService = { Agents.Administrador };
            IUServiceContext    lContext       = new IUServiceContext(exchangeInfo, "NaveNodriza", "delete_instance", "SIU_delete_instance");
            IUServiceController lController    = new IUServiceController("delete_instance", "Destroy", "Clas_1347649273856884Ser_2_Alias", lAgentsService, "NaveNodriza", "delete_instance", lContext, null, false);

            // This controller is an InboundArgument controller.
            lController.IsOutboundArgumentController = false;


            #region Inbound arguments
            IArguments           InboundArguments = lController.InputFields;
            ArgumentOVController lArgument        = null;
            // Argument p_thisNaveNodriza.
            lArgument = new ArgumentOVController("p_thisNaveNodriza", "NaveNodriza", "Clas_1347649273856884Ser_2UIServ_1ElemAgrup_1_Alias", "NaveNodriza", false, true, false, typeof(InteractionToolkit.NaveNodriza.IUPopulations.PIU_NaveNodrizaIT).FullName, null, "", lController);
            lController.ArgumentThis = lArgument;
            InboundArguments.Add(lArgument);
            #endregion Inbound arguments

            #region Outbound arguments
            // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null.
            lController.OutboundArgumentsScenario = null;
            #endregion Outbound arguments


            return(lController);
        }
Example #4
0
 public ConfigParsedData LoadConfigFromFile(IArguments arguments)
 {
     Arguments = arguments;
     try
     {
         var lines       = new List <string>();
         var fileContent = FileSystem.File.ReadLines(GetFilePath());
         foreach (var line in fileContent)
         {
             if (line.StartsWith("#"))
             {
                 ConfigData.AddComment(new ConfigComment(line));
             }
             else if (string.IsNullOrWhiteSpace(line) && lines.Count > 0)
             {
                 ConfigData.Add(ParseSection(lines));
                 lines = new List <string>();
             }
             else if (!string.IsNullOrWhiteSpace(line) && !line.StartsWith("#"))
             {
                 lines.Add(line);
             }
         }
         if (lines.Count > 0)
         {
             ConfigData.Add(ParseSection(lines));
         }
         ConfigParsedData = ConfigData.ComputeAndReplace(Arguments, ComputeFuncs, EnumerationFuncs);
         return(ConfigParsedData);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
        /// <summary>
        /// Creates the specific IUServiceController of the 'edit_instance' IU pattern.
        /// </summary>
        /// <param name="exchangeInfo">IUServiceController reference.</param>
        /// <returns>Specific IUServiceController of the 'edit_instance' IU pattern.</returns>
        public static IUServiceController Service_edit_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController)
        {
            string[]            lAgentsService = { Agents.Administrador };
            IUServiceContext    lContext       = new IUServiceContext(exchangeInfo, "PasajeroAeronave", "edit_instance", "SIU_edit_instance");
            IUServiceController lController    = new IUServiceController("edit_instance", "Edit", "Clas_1348178542592177Ser_3_Alias", lAgentsService, "PasajeroAeronave", "edit_instance", lContext, null, false);

            // This controller is an InboundArgument controller.
            lController.IsOutboundArgumentController = false;


            #region Inbound arguments
            IArguments           InboundArguments = lController.InputFields;
            ArgumentOVController lArgument        = null;
            // Argument p_thisPasajeroAeronave.
            lArgument = new ArgumentOVController("p_thisPasajeroAeronave", "PasajeroAeronave", "Clas_1348178542592177Ser_3UIServ_1ElemAgrup_1_Alias", "PasajeroAeronave", false, true, false, typeof(InteractionToolkit.PasajeroAeronave.IUPopulations.PIU_PasajeroAeronaveIT).FullName, null, "", lController);
            lController.ArgumentThis = lArgument;
            InboundArguments.Add(lArgument);
            #endregion Inbound arguments

            #region Outbound arguments
            // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null.
            lController.OutboundArgumentsScenario = null;
            #endregion Outbound arguments


            return(lController);
        }
Example #6
0
        /// <summary>
        /// Creates the specific IUServiceController of the 'create_instance' IU pattern.
        /// </summary>
        /// <param name="exchangeInfo">IUServiceController reference.</param>
        /// <returns>Specific IUServiceController of the 'create_instance' IU pattern.</returns>
        public static IUServiceController Service_create_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController)
        {
            string[]            lAgentsService = { Agents.Administrador };
            IUServiceContext    lContext       = new IUServiceContext(exchangeInfo, "NaveNodriza", "create_instance", "Crear_NaveNodriza");
            IUServiceController lController    = new IUServiceController("create_instance", "New", "Clas_1347649273856884Ser_1_Alias", lAgentsService, "NaveNodriza", "create_instance", lContext, null);

            // This controller is an InboundArgument controller.
            lController.IsOutboundArgumentController = false;


            #region Inbound arguments
            IArguments InboundArguments = lController.InputFields;
            // Argument p_atrid_NaveNodriza.
            InboundArguments.Add(new ArgumentDVController("p_atrid_NaveNodriza", "id_NaveNodriza", "Clas_1347649273856884Ser_1UIServ_1ElemAgrup_1_Alias", ModelType.Autonumeric, 0, false, null, lController));
            // Argument p_atrNombre_NaveNodriza.
            InboundArguments.Add(new ArgumentDVController("p_atrNombre_NaveNodriza", "Nombre_NaveNodriza", "Clas_1347649273856884Ser_1UIServ_1ElemAgrup_2_Alias", ModelType.String, 100, false, null, lController));
            #endregion Inbound arguments

            #region Outbound arguments
            // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null.
            lController.OutboundArgumentsScenario = null;
            #endregion Outbound arguments


            return(lController);
        }
Example #7
0
        public void Run(IArguments arguments, int interval, int timeout)
        {
            var threads = new List <Thread>();

            foreach (var ip in arguments.IpAddresses)
            {
                Thread t = new Thread(() => new WorkThread()
                {
                    Duration = arguments.Duration, IP = ip, Interval = interval, Timeout = timeout
                }.Ping());
                threads.Add(t);
            }

            foreach (var thread in threads)
            {
                thread.Start();
            }

            while (threads.Any(x => x.IsAlive))
            {
                FileWriter.Run();
            }

            foreach (var thread in threads)
            {
                thread.Join();
            }

            FileWriter.End();
        }
Example #8
0
        /// <summary>
        /// Creates an instance and sets it up using <paramref name="arguments"/>.
        /// </summary>
        /// <param name="arguments">The arguments that define how this instance behaves. Only
        /// <see cref="IArguments.OutputDirectory"/> and <see cref="IArguments.SpecifiedOutputDirectory"/> are
        /// consumed in the constructor.</param>
        public DataLoaderExecutor(IArguments arguments)
        {
            _arguments = arguments;
            switch (arguments.OutputDirectory)
            {
            case OutputDirectory.AppData:
                _savePath = AppData.GetFolder();
                break;

            case OutputDirectory.SourceCode:
                _savePath = Regex.Replace(Directory.GetCurrentDirectory(),
                                          @"UpdateDB((/|\\).*?)?$", "WPFSKillTree");
                break;

            case OutputDirectory.Current:
                _savePath = Directory.GetCurrentDirectory();
                break;

            case OutputDirectory.Specified:
                _savePath = arguments.SpecifiedOutputDirectory;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Log.InfoFormat("Using output directory {0}.", _savePath);
            _savePath = Path.Combine(_savePath, "Data");

            // The Affix file is big enough to be starved by other requests sometimes.
            _httpClient.Timeout = TimeSpan.FromSeconds(120);
        }
Example #9
0
 internal ExpressionEventArgs(Expression expression, Exception exception, IArguments arguments, object result)
 {
     _lazyArguments = arguments;
     Expression     = expression;
     Exception      = exception;
     Result         = result;
 }
Example #10
0
        public override double Solve(IArguments iArguments)
        {
            var arg       = iArguments.ConvertToOneArgument();
            var converter = new Converter();

            return(Math.Cos(converter.GetAngle(arg.First, arg.Unit)));
        }
Example #11
0
        public override double Solve(IArguments iArguments)
        {
            var arg    = iArguments.ConvertToOneArgument();
            var newArg = (int)arg.First;

            return(Factorial(newArg));
        }
Example #12
0
        /// <summary>
        /// Creates the specific IUServiceController of the 'create_instance' IU pattern.
        /// </summary>
        /// <param name="exchangeInfo">IUServiceController reference.</param>
        /// <returns>Specific IUServiceController of the 'create_instance' IU pattern.</returns>
        public static IUServiceController Service_create_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController)
        {
            string[]            lAgentsService = { Agents.Administrador };
            IUServiceContext    lContext       = new IUServiceContext(exchangeInfo, "PasajeroAeronave", "create_instance", "SIU_create_instance");
            IUServiceController lController    = new IUServiceController("create_instance", "New", "Clas_1348178542592177Ser_1_Alias", lAgentsService, "PasajeroAeronave", "create_instance", lContext, null);

            // This controller is an InboundArgument controller.
            lController.IsOutboundArgumentController = false;


            #region Inbound arguments
            IArguments InboundArguments = lController.InputFields;
            // Argument p_atrid_PasajeroAeronave.
            InboundArguments.Add(new ArgumentDVController("p_atrid_PasajeroAeronave", "id_PasajeroAeronave", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_1_Alias", ModelType.Autonumeric, 0, false, null, lController));
            // Argument p_agrAeronave.
            InboundArguments.Add(new ArgumentOVController("p_agrAeronave", "Aeronave", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_5_Alias", "Aeronave", true, false, false, typeof(InteractionToolkit.Aeronave.IUPopulations.PIU_AeronaveIT).FullName, null, "", lController));
            // Argument p_agrPasajero.
            InboundArguments.Add(new ArgumentOVController("p_agrPasajero", "Pasajero", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_6_Alias", "Pasajero", true, false, false, typeof(InteractionToolkit.Pasajero.IUPopulations.PIU_PasajeroIT).FullName, null, "", lController));
            // Argument p_atrNombreAeronave.
            InboundArguments.Add(new ArgumentDVController("p_atrNombreAeronave", "NombreAeronave", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_8_Alias", ModelType.String, 100, false, null, lController));
            // Argument p_atrNombrePasajero.
            InboundArguments.Add(new ArgumentDVController("p_atrNombrePasajero", "NombrePasajero", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_9_Alias", ModelType.String, 100, false, null, lController));
            #endregion Inbound arguments

            #region Outbound arguments
            // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null.
            lController.OutboundArgumentsScenario = null;
            #endregion Outbound arguments


            return(lController);
        }
Example #13
0
        public void Execute(IArguments arguments)
        {
            if (arguments.Delete)
            {
                _log.Warn($"Deleting is running");
                _reportingServiceProxy.DeleteAllFolders();
            }

            if (arguments.Backup)
            {
                _reportManager.Backup(_settings.BackupPath);
                _subscriptionManager.Backup(_settings.BackupPath);
                return;
            }

            Run(arguments.ReportName, arguments.FolderName, arguments.Recreate);

            void Run(string reportName, string projectName, bool recreate)
            {
                if (arguments.Report)
                {
                    _reportManager.Deploy(
                        reportName,
                        projectName,
                        _settings.DatasetsServerFolderName,
                        _settings.DataSourcesServerFolderName,
                        recreate);
                }

                if (arguments.Subscription)
                {
                    _subscriptionManager.Deploy(reportName, recreate);
                }
            }
        }
Example #14
0
 public BumpVersionsHandler(IOutput output, IArguments args, UtilitiesEnvironment environment, VersionService versions)
 {
     _output      = output;
     _args        = args;
     _environment = environment;
     _versions    = versions;
 }
Example #15
0
 internal LhsExpressionEventArgs(Expression expression, Exception exception, IArguments arguments, object result, ITuple tuple, IFact fact, IEnumerable <IRuleDefinition> rules)
     : base(expression, exception, arguments, result)
 {
     _tuple = tuple;
     _fact  = fact;
     Rules  = rules;
 }
Example #16
0
 private IEnumerable <string> GetParameter(string argumentName, IArguments arguments, Dictionary <string, List <string> > dict)
 {
     try
     {
         var argResult = arguments.GetArgument(argumentName);
         if (argResult.IsFound())
         {
             return(new List <string> {
                 argResult.Result
             });
         }
         else
         {
             return(dict[argumentName]);
         }
     }
     catch (Exception ex)
     {
         if (dict.ContainsKey(argumentName))
         {
             return(dict[argumentName]);
         }
         throw new ArgumentException($"{nameof(argumentName)}:{argumentName}", ex);
     }
 }
Example #17
0
 public Runner(ISemanticVersioning versioning, IPackageReader reader, INuGetFactory nugetFactory, IArguments arguments)
 {
     _versioning = versioning;
     _nugetFactory = nugetFactory;
     _packageReader = reader;
     _arguments = arguments;
 }
Example #18
0
        /// <summary>
        /// Not for public consumption! Only exposed for unit testing!
        /// </summary>
        internal ServiceProvider InitializeServiceProvider(IArguments arguments)
        {
            DependencyInjectionConfig.ConfigureServices(serviceCollection);
            serviceCollection.AddSingleton(arguments);

            return(serviceCollection.BuildServiceProvider());
        }
Example #19
0
        public CommandInput(IArguments args)
        {
            if (args == null)
                throw new ArgumentNullException("args");

            Args = args;
        }
        /// <summary>
        /// Find and execute the appropriate handler for the given verb and arguments
        /// </summary>
        /// <param name="verb"></param>
        /// <param name="args"></param>
        /// <param name="token"></param>
        public void Execute(string verb, IArguments args, CancellationToken token = default)
        {
            Assert.ArgumentNotNullOrEmpty(verb, nameof(verb));
            var command = Command.Create(verb, args);

            Execute(command, token);
        }
        /// <summary>
        /// Find and execute the appropriate handler for the given verb and arguments
        /// </summary>
        /// <param name="verb"></param>
        /// <param name="args"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public Task ExecuteAsync(string verb, IArguments args, CancellationToken token = default)
        {
            Assert.ArgumentNotNullOrEmpty(verb, nameof(verb));
            var command = Command.Create(verb, args);

            return(ExecuteAsync(command, token));
        }
Example #22
0
 public TestCommandHandler(IOutput output, EngineState state, IArguments args, CommandDispatcher dispatcher)
 {
     Output     = output;
     State      = state;
     Args       = args;
     Dispatcher = dispatcher;
 }
Example #23
0
        public string Generate(IArguments arguments)
        {
            var file = arguments.GetArgumentOrThrow <string>("file");

            var path = _settings.OutputDirectory.Combine(file);

            file = _settings.Configuration.HostName + file;

            var sri = ComputeSRI(path);

            if (path.Extension == ".js")
            {
                _log.Detail("Creating SRI script tag for: {0}", path);
                return($"<script src=\"{file}\" integrity=\"{sri}\" crossorigin=\"anonymous\"></script>");
            }
            else if (path.Extension == ".css")
            {
                _log.Detail("Creating SRI css tag for: {0}", path);
                return($"<link rel=\"stylesheet\" href=\"{file}\" integrity=\"{sri}\" crossorigin=\"anonymous\"/>");
            }
            else
            {
                _log.Warning("Unsupprted file type for SRI linking: {0}", path.Extension);
            }

            return(string.Empty);
        }
Example #24
0
        /// <summary>
        /// Creates an instance and sets it up using <paramref name="arguments"/>.
        /// </summary>
        /// <param name="arguments">The arguments that define how this instance behaves. Only
        /// <see cref="IArguments.OutputDirectory"/> and <see cref="IArguments.SpecifiedOutputDirectory"/> are
        /// consumed in the constructor.</param>
        public DataLoaderExecutor(IArguments arguments)
        {
            _arguments = arguments;
            switch (arguments.OutputDirectory)
            {
            case OutputDirectory.AppData:
                _savePath = AppData.GetFolder();
                break;

            case OutputDirectory.SourceCode:
                _savePath = Regex.Replace(Directory.GetCurrentDirectory(),
                                          @"UpdateDB((/|\\).*?)?$", "WPFSKillTree");
                break;

            case OutputDirectory.Current:
                _savePath = Directory.GetCurrentDirectory();
                break;

            case OutputDirectory.Specified:
                _savePath = arguments.SpecifiedOutputDirectory;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Log.InfoFormat("Using output directory {0}.", _savePath);
            _savePath = Path.Combine(_savePath, "Data");

            _loaderDefinitions.ForEach(l => l.DataLoader.HttpClient = _httpClient);

            // The Affix file is big enough to be starved by other requests sometimes.
            _httpClient.Timeout = TimeSpan.FromSeconds(120);
            _httpClient.DefaultRequestHeaders.Add("User-Agent",
                                                  "PoESkillTree UpdateDB (https://github.com/PoESkillTree/PoESkillTree/tree/master/UpdateDB)");
        }
Example #25
0
        /// <summary>
        /// Map from the provided arguments onto the public properties of an existing
        /// object
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="args"></param>
        /// <param name="obj"></param>
        public static void MapOnto <T>(IArguments args, T obj)
        {
            var targetType       = typeof(T);
            var publicProperties = targetType.GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                   .Where(p => p.CanWrite && p.SetMethod != null)
                                   .ToList();

            foreach (var property in publicProperties)
            {
                // Try to map positional argument if the attribute is set
                var attr = property.GetCustomAttributes <ArgumentIndexAttribute>(true).FirstOrDefault();
                if (attr != null)
                {
                    var index = attr.Index;
                    var positionalArgument = args.Consume(index);
                    AssignPropertyValue(positionalArgument, property, obj);
                    continue;
                }

                if ((property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?)) && args.ConsumeFlag(property.Name).Exists())
                {
                    property.SetValue(obj, true);
                    continue;
                }

                var namedArg = args.Consume(property.Name);
                if (namedArg.Exists())
                {
                    AssignPropertyValue(namedArg, property, obj);
                }
            }
        }
Example #26
0
        public void Run(IArguments args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            if (!(args is TArgs))
            {
                throw new ArgumentException("args type doesn't match generic type", "args");
            }

            if (Log == null)
            {
                throw new InvalidOperationException("ICommand.Log cannot be null.");
            }

            if (!args.IsValid)
            {
                throw new InvalidOperationException("Argument validation failed. Arguments are invalid.");
            }

            var commandArgs = (TArgs)args;

            try
            {
                InvokeCommandStarting(commandArgs);
                Execute(commandArgs);
            }
            finally
            {
                InvokeCommandEnded(commandArgs);
            }
        }
Example #27
0
        public static void CreateNew(IArguments arguments)
        {
            // Validate the mandatory input params
            if (!arguments.ContainsKey("type"))
            {
                throw new ArgumentException("-type not provided");
            }

            if (!arguments.ContainsKey("port"))
            {
                throw new ArgumentException("-port not provided");
            }

            if (!arguments.ContainsKey("host"))
            {
                throw new ArgumentException("-host not provided");
            }

            if (!arguments.ContainsKey("username"))
            {
                throw new ArgumentException("-username not provided");
            }

            if (!arguments.ContainsKey("password"))
            {
                throw new ArgumentException("-password not provided");
            }

            if (_current == null)
            {
                _current = new UnitTestContext(arguments);
            }
        }
Example #28
0
 /// <summary>
 /// Get a list of all argument objects
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <IArgument> GetAllArguments(this IArguments args)
 {
     Assert.ArgumentNotNull(args, nameof(args));
     return(args.GetAllPositionals().Cast <IArgument>()
            .Concat(args.GetAllNamed())
            .Concat(args.GetAllFlags())
            .Where(p => !p.Consumed));
 }
Example #29
0
        public string Generate(IArguments arguments)
        {
            var file = arguments.GetArgumentOrThrow <string>("file");

            _log.Info("Trying to execute PHP CGI script: {0} ...", file);

            return(ExecuteScriptProcess("php-cgi", _appSetting.PhpPath, file, _appSetting.PhpTimeout));
        }
 public IEnumerable<IArgument> Access(IArguments args)
 {
     var arg = args.Get(_name);
     if (!arg.Exists())
         return Enumerable.Empty<IArgument>();
     arg.MarkConsumed();
     return new [] { new NamedArgument(_name, arg.AsString(string.Empty)) };
 }
Example #31
0
 public IEnumerable<IArgument> Access(IArguments args)
 {
     var arg = args.Get(_index);
     if (!arg.Exists() || arg.Consumed)
         return Enumerable.Empty<IArgument>();
     arg.MarkConsumed();
     return new [] { new PositionalArgument(arg.AsString(string.Empty)) };
 }
 public ResourceDownloader(IArguments arguments,
                           IHttpClient httpClient,
                           IFileSystem fileSystem)
 {
     this.arguments  = arguments;
     this.httpClient = httpClient;
     this.fileSystem = fileSystem;
 }
Example #33
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "ReportEngine" /> class.
        /// </summary>
        /// <param name = "arguments">
        ///   Specifies the arguments.
        /// </param>
        /// <param name = "modelBuilder">
        ///   Specifies the model builder for building a report model from an assembly.</param>
        /// <param name = "reportGenerator">
        ///   Specifies the report generator which generates the output.
        /// </param>
        /// <exception cref = "ArgumentNullException">
        ///   Thrown when one of the parameters is <c>null</c>.
        /// </exception>
        public ReportEngine(IArguments arguments, IModelBuilder modelBuilder, IReportGenerator reportGenerator)
        {
            Guard.AgainstArgumentNull(arguments, "arguments");
            Guard.AgainstArgumentNull(modelBuilder, "modelBuilder");
            Guard.AgainstArgumentNull(reportGenerator, "reportGenerator");

            _arguments = arguments;
            _modelBuilder = modelBuilder;
            _reportGenerator = reportGenerator;
        }
Example #34
0
 public object GetValue(string name, Type type, IArguments arguments, IRequest request, Context context)
 {
     if (arguments.ContentType.IsJson) {
         var jsonText = arguments.GetContent();
         return JsonConverter.Parse<Dictionary<string, string>>(jsonText);
     }
     if (arguments.ContentType.IsNameValue) {
         var result = new Dictionary<string, string>();
         foreach (var pair in arguments) {
             result.Add(pair.Key,pair.Value);
         }
         return result;
     }
     throw new ArgumentException("Cannot Bind value for " + type.FullName);
 }
Example #35
0
        /// <summary>
        /// Costruct with specific options.
        /// </summary>
        /// <param name="arguments">The collection of options used by stubby.</param>
        public Stubby(IArguments arguments)
        {
            _arguments = arguments ?? new Arguments { Mute = true };
            _admin = arguments.DisableAdmin ? null : new Admin(_endpointDb);
            _stubs = new Stubs(_endpointDb);

            Out.Mute = _arguments.Mute;
            LoadEndpoints();

            if (!_arguments.Watch)
                return;

            _watcher.Path = Path.GetDirectoryName(_arguments.Data);
            _watcher.Filter = Path.GetFileName(_arguments.Data);
            _watcher.Changed += OnDatafileChange;
            _watcher.EnableRaisingEvents = _arguments.Watch;
        }
		public ICommand Create(IArguments arguments)
		{
			var commandType = typeof(ICommandWithArguments<>);
			var genericType = commandType.MakeGenericType(arguments.GetType());

			var command = _dependancyContainer.Resolve(genericType);

			if (command == null)
				return null;

			var compiledCommandType = typeof(CompiledCommand<,>);
			var genericCompiledCommandType = compiledCommandType.MakeGenericType(genericType, arguments.GetType());

			var result = (ICommand) Activator.CreateInstance(genericCompiledCommandType, command, arguments);

			return result;
		}
Example #37
0
        private UnitTestContext(IArguments arguments)
        {
            if (arguments == null)
                throw new InvalidOperationException(
                    "Current Context could not be initialized. No arguments passed to the context");

            var element = new LogElement
            {
                Parameters = "-ShowOnConsole:true ",
                ProviderType = "KonfDB.Infrastructure.Logging.Logger, KonfDBC"
            };

            if (arguments.ContainsKey("runtime-logConfigPath"))
                element.Parameters += "-path:" + arguments["runtime-logConfigPath"];

            var logger = LogFactory.CreateInstance(element);

            CurrentContext.CreateDefault(logger, arguments, null);
        }
Example #38
0
        public Logger(IArguments args)
            : base(args)
        {
            if (args.ContainsKey("logConfigPath") && File.Exists(args["logConfigPath"]))
            {
                XmlConfigurator.Configure(new FileInfo(args["logConfigPath"]));
                _log = LogManager.GetLogger("KonfDB");
            }
            else
            {
                _log = LogManager.GetLogger("KonfDB");
                var appenders = new List<IAppender> {CreateFileAppender("FileAppender", @"Logs\KonfDB.log")};

                if (args.GetValue("ShowOnConsole", "false")
                    .Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase))
                    appenders.Add(CreateConsoleAppender());

                BasicConfigurator.Configure(appenders.ToArray());
            }
        }
Example #39
0
        public static void CreateNew(IArguments arguments)
        {
            // Validate the mandatory input params
            if (!arguments.ContainsKey("type"))
                throw new ArgumentException("-type not provided");

            if (!arguments.ContainsKey("port"))
                throw new ArgumentException("-port not provided");

            if (!arguments.ContainsKey("host"))
                throw new ArgumentException("-host not provided");

            if (!arguments.ContainsKey("username"))
                throw new ArgumentException("-username not provided");

            if (!arguments.ContainsKey("password"))
                throw new ArgumentException("-password not provided");

            if (_current == null)
                _current = new UnitTestContext(arguments);
        }
Example #40
0
 public static IContext CreateDefault(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     return _defaultContext ?? (_defaultContext = new CurrentContext(baseLogger, arguments, cacheStore));
 }
Example #41
0
 private CurrentContext(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     Log = baseLogger;
     ApplicationParams = arguments;
     Cache = cacheStore;
 }
Example #42
0
 public object ExecuteWithResult(object instance, IArguments arguments, IRequest request, Context context)
 {
     var waitor = Execution(instance, arguments, request, context);
     waitor.Wait();
     return null;
 }
Example #43
0
 /// <summary>
 /// Creates a new instance of the <see cref="FileWriter"/> class.
 /// </summary>
 /// <param name="arguments">
 /// Specifies the arguments for this writer.
 /// </param>
 /// <param name="fileSystemHelper">
 /// Specifies the helper for 
 /// </param>
 public FileWriter(IArguments arguments, IFileSystemHelper fileSystemHelper)
 {
     _arguments = arguments;
     _fileSystemHelper = fileSystemHelper;
 }
Example #44
0
 public async Task ExecuteAsyncWithoutResult(object instance, IArguments arguments, IRequest request, Context context)
 {
     await Task.Run(()=> Execution(instance, arguments, request, context));
 }
Example #45
0
 public async Task<object> ExecuteAsyncWithResult(object instance, IArguments arguments, IRequest request, Context context)
 {
     return await Task.Run<object>(() => Execution(instance, arguments, request, context));
 }
 public virtual void BuildUp(IArguments args, object target)
 {
     _buildUp(args, target);
 }
Example #47
0
 public object ExecuteWithResult(object instance, IArguments arguments, IRequest request, Context context)
 {
     return Execution(instance, arguments, request, context);
 }
 public BugzSubmitAdapter(IArguments arguments)
 {
     this.arguments = arguments;
 }
Example #49
0
 public NuGetFactory(IArguments arguments)
 {
     _arguments = arguments;
 }
Example #50
0
 protected BaseLogger(IArguments args)
 {
     _arguments = args;
 }
Example #51
0
 public AzureLogger(IArguments args) : base(args)
 {
 }
Example #52
0
 public async Task<object> ExecuteAsyncWithResult(object instance, IArguments arguments, IRequest request, Context context)
 {
     await Execution(instance, arguments, request, context);
     return null;
 }
Example #53
0
 public void ExecuteWithoutResult(object instance, IArguments arguments, IRequest request, Context context)
 {
     Execution(instance, arguments, request, context);
 }
Example #54
0
 public KonfDBH(IArguments arguments)
 {
     _arguments = arguments;
 }
 public virtual object BuildInstance(IArguments args)
 {
     return _constructor(args);
 }