Class CommandShellManager
The shell manager is the root of the shell lib framework.
Inheritance
Inherited Members
Namespace: Simplic.CommandShell
Assembly: Simplic.CommandShell.dll
Syntax
public class CommandShellManager
Properties
| Improve this Doc View SourceActiveShellContext
Get the active shell context
Declaration
public CommandShellContext ActiveShellContext { get; }
Property Value
Type | Description |
---|---|
CommandShellContext |
Singleton
Singleton access to the shell manager instance
Declaration
public static CommandShellManager Singleton { get; }
Property Value
Type | Description |
---|---|
CommandShellManager |
Methods
| Improve this Doc View SourceActivateLastShellContext()
Move to last shell context. For example for nested contexts and exit commands
Declaration
public void ActivateLastShellContext()
ActivateShellContext(String)
Activate a shell context by its name, if the shell context is already activated, nothing happens.
Declaration
public void ActivateShellContext(string contextName)
Parameters
Type | Name | Description |
---|---|---|
System.String | contextName | Name of the shell context |
CoutActivatedShellCotnexts()
Cound the active shell contexts
Declaration
public int CoutActivatedShellCotnexts()
Returns
Type | Description |
---|---|
System.Int32 | Number of items |
CreateShellContext(String)
Create shell context, if it is the first shell context, it will be activated directly
Declaration
public CommandShellContext CreateShellContext(string contextName)
Parameters
Type | Name | Description |
---|---|---|
System.String | contextName | Name of the context |
Returns
Type | Description |
---|---|
CommandShellContext | Instance if the shell context |
Execute(String, out Boolean)
Execute a shell command
Declaration
public string Execute(string command, out bool errorOccured)
Parameters
Type | Name | Description |
---|---|---|
System.String | command | Command line content |
System.Boolean | errorOccured | Out parameter which defines wether an error occured |
Returns
Type | Description |
---|---|
System.String | Return-Message of the execute method |
ExecuteArgs(String, String[], out Boolean)
Execute program arguments as a shell command
Declaration
public string ExecuteArgs(string cmdName, string[] args, out bool errorOccured)
Parameters
Type | Name | Description |
---|---|---|
System.String | cmdName | Command name |
System.String[] | args | Arguments |
System.Boolean | errorOccured | Out parameter which defines wether an error occured |
Returns
Type | Description |
---|---|
System.String | Result of the cmd |
ExecuteArgs(String[], out Boolean)
Executes a program based on program args Command included
Declaration
public string ExecuteArgs(string[] args, out bool errorOccured)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | args | 1:1 args program parameter |
System.Boolean | errorOccured | Out parameter which defines wether an error occured |
Returns
Type | Description |
---|---|
System.String |
ExecuteFile(String, Boolean, out Boolean)
Execute all commands in a file
Declaration
public string ExecuteFile(string fileName, bool continueOnError, out bool errorOccured)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Path to the file |
System.Boolean | continueOnError | Continues if an error occurse |
System.Boolean | errorOccured | Out parameter which defines wether an error occured |
Returns
Type | Description |
---|---|
System.String | Result-String |
ExecuteMultiline(String, Boolean, out Boolean)
Execute multiple commands
Declaration
public string ExecuteMultiline(string commands, bool continueOnError, out bool errorOccured)
Parameters
Type | Name | Description |
---|---|---|
System.String | commands | String with commands |
System.Boolean | continueOnError | Continues if an error occurse |
System.Boolean | errorOccured | Out parameter which defines wether an error occured |
Returns
Type | Description |
---|---|
System.String | Result-String |