コード例 #1
0
        /// <summary>
        /// Finds the best matching registered credential for <paramref name="path"/>
        /// and executes an external program with this credential
        /// </summary>
        /// <param name="path"><see cref="ResourcePath"/> to which the external program shall have access</param>
        /// <param name="executable">External program to execute</param>
        /// <param name="arguments">Arguments for the external program</param>
        /// <param name="priorityClass">Process priority</param>
        /// <param name="maxWaitMs">Maximum time to wait for completion</param>
        /// <returns>A <see cref="Task"/> representing the result of executing the external program</returns>
        public Task <ProcessExecutionResult> ExecuteWithResourceAccessAsync(ResourcePath path, string executable, string arguments, ProcessPriorityClass priorityClass, int maxWaitMs)
        {
            WindowsIdentityWrapper bestMatchingIdentity;

            return(TryGetBestMatchingIdentityForPath(path, out bestMatchingIdentity) ?
                   AsyncImpersonationProcess.ExecuteAsync(executable, arguments, bestMatchingIdentity, _debugLogger, priorityClass, maxWaitMs) :
                   ProcessUtils.ExecuteAsync(executable, arguments, priorityClass, maxWaitMs));
        }
コード例 #2
0
ファイル: FFMpegLib.cs プロジェクト: haibin05/MediaPortal-2
 /// <summary>
 /// Executes FFProbe. This function doesn't check if impersionation is necessary
 /// </summary>
 /// <param name="arguments">Arguments for FFProbe</param>
 /// <param name="priorityClass">Process priority</param>
 /// <param name="maxWaitMs">Maximum time to wait for completion</param>
 /// <returns>A <see cref="Task"/> representing the result of executing FFProbe</returns>
 /// <remarks>
 /// This is a convenience method that enables executing FFProbe directly.
 /// </remarks>
 public static Task <ProcessExecutionResult> FFProbeExecuteAsync(string arguments, ProcessPriorityClass priorityClass, int maxWaitMs)
 {
     return(ProcessUtils.ExecuteAsync(_ffProbeBinPath, arguments, priorityClass, maxWaitMs));
 }
コード例 #3
0
 public Task <ProcessExecutionResult> ExecuteWithResourceAccessAsync(ResourcePath path, string executable, string arguments, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = 10000)
 {
     return(ProcessUtils.ExecuteAsync(executable, arguments, priorityClass, maxWaitMs));
 }