Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

Shell Class Reference

Interprets and executes the user commands. More...

List of all members.

Public Member Functions

 Shell ()
bool PutCommand (string command)
void Load (string parameters)
 Retrieves (loads) the workspace and the command history.
void Save (string parameters)
 Stores the workspace and the command history.
delegate void ShellEvent (object parameter)
delegate void GeneratedSourceChangeHandler (object sourceCode)
delegate void NewCommandHistoryHandler ()


ArrayList CommandNames
 A list of the names of all build-in command.
ObservableWriterStream StdOut = new ObservableWriterStream()
ObservableWriterStream StdError = new ObservableWriterStream()
ObservableWriterStream UserProgramOut = new ObservableWriterStream()
ObservableWriterStream UserProgramError = new ObservableWriterStream()
event GeneratedSourceChangeHandler OnSourceChange
readonly string GeneratedSourceCode = ""
readonly Workspace Workspace
DllAndNamespaceHandling DllAndNamespaceHandling = new DllAndNamespaceHandling(true)
ShellCommands _shellCommands
ArrayList CommandHistory = new ArrayList()
event ShellEvent OnCommandAdded
event NewCommandHistoryHandler OnNewCommandHistory
Help help = new Help()
static string _defaultFileName = "CSharpShell.dat"
static readonly string _className = "UserCode"
static readonly string _prependUserClass
static readonly string _appendUserClass
static readonly string _helpText

Private Member Functions

void GetFirstWordOfInput (string input, out string firstWord, out string parameters)
void ExecuteUserCode (string code)
string VariableUseMatch (Match m)
void InvokeExecuteUserCodeMethod (string fileName)
bool CreateClassCode (string inCode, string compileString, DllAndNamespaceHandling dllAndNamespaceHandling, out string outCode)
string Whos ()
 Displays all workspace variables.
string Help (string parameters)
 Displays a help text.
void Methods (string parameters)
 Displays the public methods of a workspace variable.
string ParametersToFileName (string parameters)
void Clear (string parameters)

Static Private Member Functions

static string MakeCompileString (DllAndNamespaceHandling dllAndNamespaceHandling, string fileName)

Detailed Description

Interprets and executes the user commands.

Via the Workspace class it also stores the workspace variables. It also stores which namespaces, dlls, and paths should be included when compiling user code (via DllAndNamespaceHandling class). Finally it stores the command history.

Make normal load/save behaviour. That is, when just write save the program should use the last save filename (if not exist then CSharpShell.dat). If no sirname .dat should be automatically added.

Constructor & Destructor Documentation

Shell::Shell  )  [inline]

Member Function Documentation

void Shell::Clear string  parameters  )  [inline, private]

bool Shell::CreateClassCode string  inCode,
string  compileString,
DllAndNamespaceHandling  dllAndNamespaceHandling,
out string  outCode
[inline, private]

void Shell::ExecuteUserCode string  code  )  [inline, private]

Compiles and executes C# code.

code The code to be compiled and executed.
Report error that mcs do newer use stderror. Even if an input file do not exist.

delegate void Shell::GeneratedSourceChangeHandler object  sourceCode  ) 

void Shell::GetFirstWordOfInput string  input,
out string  firstWord,
out string  parameters
[inline, private]

string Shell::Help string  parameters  )  [inline, private]

Displays a help text.

void Shell::InvokeExecuteUserCodeMethod string  fileName  )  [inline, private]

missing standard input, currently we just use the console when invoking user code.

void Shell::Load string  parameters  )  [inline]

Retrieves (loads) the workspace and the command history.

static string Shell::MakeCompileString DllAndNamespaceHandling  dllAndNamespaceHandling,
string  fileName
[inline, static, private]

void Shell::Methods string  parameters  )  [inline, private]

Displays the public methods of a workspace variable.

delegate void Shell::NewCommandHistoryHandler  ) 

string Shell::ParametersToFileName string  parameters  )  [inline, private]

Used by load and save command. It extracts the filename from parameters. If no filename is present it used the _defaultFileName.

bool Shell::PutCommand string  command  )  [inline]

void Shell::Save string  parameters  )  [inline]

Stores the workspace and the command history.

delegate void Shell::ShellEvent object  parameter  ) 

string Shell::VariableUseMatch Match  m  )  [inline, private]

string Shell::Whos  )  [inline, private]

Displays all workspace variables.

Property Documentation

readonly string Shell::_appendUserClass [static, private]

Initial value:


readonly string Shell::_className = "UserCode" [static, private]

string Shell::_defaultFileName = "CSharpShell.dat" [static, private]

readonly string Shell::_helpText [static, private]

Initial value:


Currently C#Shell supports the following build-in commands:

        - help
        - load [file name]
        - save [file name]
        - whos
        - methods <variable>
        - quit
        - exit

Help is the current command. Load and save retrieves and stores the current workspace (variables and command history). Whos shows all your variables. Methods shows which methods a variable supports. Quit and exit stops C#Shell.

Please try this program and send any comments to"

readonly string Shell::_prependUserClass [static, private]

Initial value:

class " + _className + @" : IUserCode {
public void ExecuteUserCode(Workspace workspace) {

if (workspace == null) {
System.Console.WriteLine(" + "\"Ugler i mosen. Workspace is a null reference\"" + @"); 
#line 1

ShellCommands Shell::_shellCommands [private]

ArrayList Shell::CommandHistory = new ArrayList()

ArrayList Shell::CommandNames [get]

A list of the names of all build-in command.

DllAndNamespaceHandling Shell::DllAndNamespaceHandling = new DllAndNamespaceHandling(true)

readonly string Shell::GeneratedSourceCode = ""

Help Shell::help = new Help() [private]

event ShellEvent Shell::OnCommandAdded

event NewCommandHistoryHandler Shell::OnNewCommandHistory

event GeneratedSourceChangeHandler Shell::OnSourceChange

ObservableWriterStream Shell::StdError = new ObservableWriterStream()

ObservableWriterStream Shell::StdOut = new ObservableWriterStream()

ObservableWriterStream Shell::UserProgramError = new ObservableWriterStream()

ObservableWriterStream Shell::UserProgramOut = new ObservableWriterStream()

readonly Workspace Shell::Workspace

The documentation for this class was generated from the following file: Logo