Class EnvironmentBuilder
- Namespace
- ZeroInstall.Services.Executors
- Assembly
- ZeroInstall.Services.dll
Fluent-style builder for a process execution environment for a Selections document.
public class EnvironmentBuilder : IEnvironmentBuilder
- Inheritance
-
EnvironmentBuilder
- Implements
- Inherited Members
Constructors
EnvironmentBuilder(IImplementationStore)
Fluent-style builder for a process execution environment for a Selections document.
public EnvironmentBuilder(IImplementationStore implementationStore)
Parameters
implementationStore
IImplementationStore
Methods
AddArguments(params string[])
Appends user specified arguments
to the command-line.
public IEnvironmentBuilder AddArguments(params string[] arguments)
Parameters
arguments
string[]
Returns
- IEnvironmentBuilder
The execution environment. Reference to self for fluent API use.
AddWrapper(string?)
Instead of executing the selected program directly, pass it as an argument to this program. Useful for debuggers. May contain command-line arguments. Whitespaces must be escaped!
public IEnvironmentBuilder AddWrapper(string? wrapper)
Parameters
wrapper
string
Returns
- IEnvironmentBuilder
The execution environment. Reference to self for fluent API use.
Inject(Selections, string?)
Sets the Selections to be injected. Must be called before any methods of the IEnvironmentBuilder interface are used. May not be called more than once.
public IEnvironmentBuilder Inject(Selections selections, string? overrideMain = null)
Parameters
selections
SelectionsThe set of Implementations be injected into the execution environment.
overrideMain
stringAn alternative executable to to run from the main Implementation instead of Main. May not contain command-line arguments! Whitespaces do not need to be escaped.
Returns
- IEnvironmentBuilder
The execution environment. Reference to self for fluent API use.
Exceptions
- ImplementationNotFoundException
One of the Implementations is not cached yet.
- ExecutorException
The executor was unable to process the Selections.
- IOException
A problem occurred while writing a file.
- UnauthorizedAccessException
Write access to a file is not permitted.
SetEnvironmentVariable(string, string?)
Sets an environment variable in the execution environment.
public IEnvironmentBuilder SetEnvironmentVariable(string name, string? value)
Parameters
name
stringThe name of the environment variable.
value
stringThe value to set the environment variable to.
Returns
- IEnvironmentBuilder
The execution environment. Reference to self for fluent API use.
Start()
Starts the program.
public Process Start()
Returns
Exceptions
- ImplementationNotFoundException
One of the Implementations is not cached yet.
- ExecutorException
The IExecutor was unable to process the Selections or the main executable could not be launched.
- FileNotFoundException
Failed to find the main executable.
- IOException
Failed to start the program.
- UnauthorizedAccessException
Write access to a file is not permitted.
ToStartInfo()
Builds a ProcessStartInfo for starting the program.
public ProcessStartInfo ToStartInfo()
Returns
- ProcessStartInfo
The ProcessStartInfo that can be used to start the new Process.
Exceptions
- ImplementationNotFoundException
One of the Implementations is not cached yet.
- ExecutorException
The IExecutor was unable to process the Selections.
- IOException
A problem occurred while writing a file.
- UnauthorizedAccessException
Write access to a file is not permitted.