Show / Hide Table of Contents

Interface IProcessLauncher

Runs an external process.

Namespace: NanoByte.Common.Native
Assembly: NanoByte.Common.dll
Syntax
public interface IProcessLauncher

Methods

GetStartInfo(String[])

Creates the ProcessStartInfo used to launch the process.

Declaration
ProcessStartInfo GetStartInfo(params string[] arguments)
Parameters
Type Name Description
String[] arguments

The arguments to pass to the process at startup.

Returns
Type Description
ProcessStartInfo

Run(String[])

Runs the process and waits for it to exit.

Declaration
void Run(params string[] arguments)
Parameters
Type Name Description
String[] arguments

Command-line arguments to launch the process with.

Exceptions
Type Condition
IOException

There was a problem launching the executable.

FileNotFoundException

The executable file could not be found.

NotAdminException

The target process requires elevation.

ExitCodeException

The process exited with a non-zero ExitCode.

RunAndCapture(Action<StreamWriter>, String[])

Runs the process, captures its stdout and stderr output and waits for it to exit.

Declaration
string RunAndCapture(Action<StreamWriter> onStartup, params string[] arguments)
Parameters
Type Name Description
Action<StreamWriter> onStartup

A callback for writing to the process' stdin right after startup.

String[] arguments

Command-line arguments to launch the process with.

Returns
Type Description
String

The process' complete stdout output.

Exceptions
Type Condition
IOException

There was a problem launching the executable.

FileNotFoundException

The executable file could not be found.

NotAdminException

The target process requires elevation.

ExitCodeException

The process exited with a non-zero ExitCode.

Start(String[])

Starts the process and runs it in parallel with this one.

Declaration
Process Start(params string[] arguments)
Parameters
Type Name Description
String[] arguments

Command-line arguments to launch the process with.

Returns
Type Description
Process

The newly launched process.

Exceptions
Type Condition
IOException

There was a problem launching the executable.

FileNotFoundException

The executable file could not be found.

NotAdminException

The target process requires elevation.

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
ProcessLauncherExtensions.RunAndCapture(IProcessLauncher, String[])
ProcessLauncherExtensions.RunAndCapture(IProcessLauncher, ArraySegment<Byte>, String[])
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher