Exemplo n.º 1
0
        /// <summary>
        /// Runs a dotnet process. On Windows, it just runs the executable. On non-Windows,
        /// it runs the executable using Unity's mono.
        /// </summary>
        /// <remarks>You don't need to call <see cref="ProcessManager.Configure{T}(T, string)"/> on this task,
        /// it already does it in the constructor.
        /// </remarks>
        protected BaseProcessTask(ITaskManager taskManager, IProcessManager processManager,
                                  IProcessEnvironment processEnvironment,
                                  IEnvironment environment,
                                  string executable, string arguments,
                                  string workingDirectory,
                                  bool alwaysUseMono, bool neverUseMono,
                                  CancellationToken token = default)
            : base(taskManager, processEnvironment, outputProcessor: new StringOutputProcessor(), token: token)
        {
            if (neverUseMono || !alwaysUseMono && environment.IsWindows)
            {
                ProcessName      = executable;
                ProcessArguments = arguments;
            }
            else
            {
                ProcessArguments = executable + " " + arguments;
                ProcessName      = environment.UnityApplicationContents.ToSPath()
                                   .Combine("MonoBleedingEdge", "bin", "mono" + environment.ExecutableExtension);
            }

            if (processManager != null)
            {
                processManager.Configure(this, workingDirectory);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Runs a process.
        /// </summary>
        /// <remarks>You don't need to call <see cref="ProcessManager.Configure{T}(T, string)"/> on this task,
        /// it already does it in the constructor.
        /// </remarks>
        protected BaseProcessListTask(ITaskManager taskManager, IProcessManager processManager,
                                      IProcessEnvironment processEnvironment, IEnvironment environment,
                                      string executable, string arguments, string workingDirectory,
                                      Func <IProcessTask <T, List <T> >, string, bool> isMatch,
                                      Func <IProcessTask <T, List <T> >, string, T> processor,
                                      bool alwaysUseMono, bool neverUseMono,
                                      CancellationToken token = default)
            : base(taskManager, processEnvironment, token: token)
        {
            this.isMatch   = isMatch;
            this.processor = processor;

            if (neverUseMono || !alwaysUseMono && environment.IsWindows)
            {
                ProcessName      = executable;
                ProcessArguments = arguments;
            }
            else
            {
                ProcessArguments = executable + " " + arguments;
                ProcessName      = environment.UnityApplicationContents.Combine("MonoBleedingEdge", "bin", "mono" + environment.ExecutableExtension);
            }

            if (processManager != null)
            {
                processManager.Configure(this, workingDirectory);
            }
        }
Exemplo n.º 3
0
 public static T Configure <T>(this T task, IProcessManager processManager, string executable = null,
                               string arguments       = null,
                               NPath workingDirectory = null,
                               bool withInput         = false)
     where T : IProcess
 {
     return(processManager.Configure(task, executable?.ToNPath(), arguments, workingDirectory, withInput));
 }
 public StringListProcessTask(
     ITaskManager taskManager, IProcessManager processManager,
     string executable, string arguments, string workingDirectory = null,
     CancellationToken token = default
     )
     : base(taskManager,
            processManager.EnsureNotNull(nameof(processManager)).DefaultProcessEnvironment,
            executable, arguments,
            new StringListOutputProcessor(), token: token)
 {
     processManager.Configure(this, workingDirectory);
 }
Exemplo n.º 5
0
 public static T Configure <T>(this T task, IProcessManager processManager, bool withInput)
     where T : IProcess
 {
     return(processManager.Configure(task, withInput: withInput));
 }
Exemplo n.º 6
0
 public static IProcessTask <TData, T> Configure <TData, T>(this IProcessTask <TData, T> task, IProcessManager processManager, string workingDirectory) => processManager.Configure(task, workingDirectory);
 /// <summary>
 /// Helper that calls processManager.Configure
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="task"></param>
 /// <param name="processManager"></param>
 /// <param name="workingDirectory"></param>
 /// <returns></returns>
 public static T Configure <T>(this T task, IProcessManager processManager, string workingDirectory = null)
     where T : IProcessTask => processManager.Configure(task, workingDirectory);