public async Task InsertSystemParameters(SystemParameters systemParameters)
        {
            await _unitOfWork.SystemParametersRepository.Add(systemParameters);

            await _unitOfWork.SaveChangesAsync();
        }
Example #2
0
 public TestInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters parameters)
     : base(archive, modList, outputFolder, downloadFolder, parameters, steps: 1, modList.GameType)
 {
     DesiredThreads.OnNext(1);
 }
Example #3
0
 extern static bool SystemParametersInfo(SystemParameters action, uint param, IntPtr output, uint fWinIni);
Example #4
0
 public TestInstaller(string archive, ModList modList, string outputFolder, string downloadFolder, SystemParameters parameters) : base(archive, modList, outputFolder, downloadFolder, parameters)
 {
     ConfigureProcessor(1, new Subject <int>().StartWith(1));
 }
Example #5
0
        /// <summary>
        /// Executes the command
        /// </summary>
        /// <param name="args">List of arguments</param>
        /// <param name="operationResult">Operation result to write in</param>
        /// <param name="helpFormatter">Formatter object in case we need to write help</param>
        internal void ExecuteInternal(string[] args, OperationExecutionResult operationResult, IHelpFormatter helpFormatter = null)
        {
            var parsedArguments = ValidateInternal(args, operationResult);

            if (!operationResult.Valid)
            {
                CommandParser.PrintHelpInternal(Configuration, this, helpFormatter, operationResult.Messages);
                return;
            }

            try
            {
                operationResult.Messages.Add(new Operation.Messages.Progress(String.Format(Resources.ExecutingCommand, Name)));

                // Create instance of reflected type
                var target = (object)null;
                if (!MethodInfo.IsStatic)
                {
                    // No check, if it crashes it crashes
                    operationResult.Messages.Add(new Operation.Messages.Warning(String.Format(Resources.CreatingDefaultInstance, MethodInfo.DeclaringType)));
                    target = Activator.CreateInstance(MethodInfo.DeclaringType, true);
                }

                // Get values
                var allParameters = SystemParameters.Concat(Parameters).OrderBy(i => i.ParameterInfo.Position);
                var values        = allParameters.Select(i =>
                {
                    if (typeof(InputArguments).GetTypeInfo().IsAssignableFrom(i.ParameterInfo.ParameterType))
                    {
                        return(parsedArguments);
                    }
                    else if (typeof(OperationResult).GetTypeInfo().IsAssignableFrom(i.ParameterInfo.ParameterType))
                    {
                        return(operationResult);
                    }
                    else if (typeof(Array).GetTypeInfo().IsAssignableFrom(i.ParameterInfo.ParameterType))
                    {
                        var finalType   = i.ParameterInfo.ParameterType.GetElementType();
                        var objectArray = parsedArguments.GetValue(i)
                                          .Select(j => Convert.ChangeType(j, finalType))
                                          .ToArray();
                        var arr = Array.CreateInstance(finalType, objectArray.Length);
                        Array.Copy(objectArray, arr, objectArray.Length);
                        return(arr);
                    }
                    else
                    {
                        return(Convert.ChangeType(parsedArguments.GetValue(i)[0], i.ParameterInfo.ParameterType));
                    }
                })
                                    .ToArray();

                operationResult.Output = MethodInfo.Invoke(target, values);
            }
            catch (Exception e)
            {
                throw new CommandLineEngineException(Resources.ErrorExecutingCommand, operationResult, e);
            }
            finally
            {
                CommandParser.PrintDebug(operationResult.Messages);
            }
        }
Example #6
0
 public TestInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters parameters)
     : base(archive, modList, outputFolder, downloadFolder, parameters, steps: 1, modList.GameType)
 {
     Queue.SetActiveThreadsObservable(Observable.Return(1));
 }
Example #7
0
 public static extern bool SystemParametersInfo(SystemParameters uiAction, int uiParam, IntPtr pvParam,
     SystemParameterFlags fWinIni);