C# Class LazyCopy.Utilities.ProcessHelper

Contains helper methods to work with the system processes.
Afficher le fichier Open project: aleksk/LazyCopy

Méthodes publiques

Méthode Description
GetProcessName ( int processId ) : string

Gets the process name based on its processId.

GetUserNameForProcess ( Process process ) : string

Gets the name of the user for the process given.

RunProcess ( string fileName, string arguments, Action outputCallback ) : int

Starts a new fileName application with no console window created, and waits for its to finish, optionally redirecting its output to the outputCallback specified.

RunProcess ( string fileName, string arguments, string[]>.Func outputFunc ) : int

Starts a new fileName application with no console window created, and waits for its to finish, optionally redirecting its output to the outputFunc specified.

Private Methods

Méthode Description
FindUserProcesses ( string domainUser ) : IEnumerable
GetUserNameForSid ( IntPtr sid ) : string

Gets the username for the sid given.

Method Details

GetProcessName() public static méthode

Gets the process name based on its processId.
is lesser than -1.
public static GetProcessName ( int processId ) : string
processId int Process Id.
Résultat string

GetUserNameForProcess() public static méthode

Gets the name of the user for the process given.
is . /// Process token cannot be obtained. /// -or- /// Process token information cannot be retrieved. /// -or- /// Account information cannot be found. ///
public static GetUserNameForProcess ( Process process ) : string
process System.Diagnostics.Process Process to get username for.
Résultat string

RunProcess() public static méthode

Starts a new fileName application with no console window created, and waits for its to finish, optionally redirecting its output to the outputCallback specified.
is or empty.
public static RunProcess ( string fileName, string arguments, Action outputCallback ) : int
fileName string Path to the application executable.
arguments string Application arguments. Might be .
outputCallback Action Callback that receives process output. Might be .
Résultat int

RunProcess() public static méthode

Starts a new fileName application with no console window created, and waits for its to finish, optionally redirecting its output to the outputFunc specified.
is or empty.
public static RunProcess ( string fileName, string arguments, string[]>.Func outputFunc ) : int
fileName string Path to the application executable.
arguments string Application arguments. Might be .
outputFunc string[]>.Func /// Function that receives process output, and its output is redirected to the process input stream. /// Might be . ///
Résultat int