C# Класс Microsoft.Scripting.Hosting.Shell.CommandLine

Command line hosting service.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CommandLine ( ) : System
GetGlobals ( string name ) : IList
GetMemberNames ( string code ) : IList
Run ( ScriptEngine engine, IConsole console, ConsoleOptions options ) : void

Executes the comand line - depending upon the options provided we will either run a single file, a single command, or enter the interactive loop.

Terminate ( int exitCode ) : void

Защищенные методы

Метод Описание
CreateCommandDispatcher ( ) : ICommandDispatcher
CreateScope ( ) : Scope
ExecuteCommand ( ScriptSource source ) : object
ExecuteCommand ( string command ) : void
GetCommandProperties ( string code ) : ScriptCodeParseResult
GetNextAutoIndentSize ( string text ) : int

Gets the next level for auto-indentation

GetOutputWriter ( bool isErrorOutput ) : TextWriter
Initialize ( ) : void
PrintLogo ( ) : void
ReadLine ( int autoIndentSize ) : string
ReadStatement ( bool &continueInteraction ) : string

Read a statement, which can potentially be a multiple-line statement suite (like a class declaration).

Run ( ) : int

Runs the command line. Languages can override this to provide custom behavior other than: 1. Running a single command 2. Running a file 3. Entering the interactive console loop.

RunCommand ( string command ) : int
RunFile ( string fileName ) : int
RunInteractive ( ) : int

Starts the interactive loop. Performs any initialization necessary before starting the loop and then calls RunInteractiveLoop to start the loop. Returns the exit code when the interactive loop is completed.

TryInteractiveAction ( ) : int?

Attempts to run a single interaction and handle any language-specific exceptions. Base classes can override this and call the base implementation surrounded with their own exception handling. Returns null if successful and execution should continue, or an exit code.

UnhandledException ( Exception e ) : void

Приватные методы

Метод Описание
IsFatalException ( Exception e ) : bool
RunFile ( ScriptSource source ) : int
RunInteractiveLoop ( ) : int
RunOneInteraction ( ) : int?

Parses a single interactive command or a set of statements and executes it. Returns null if successful and execution should continue, or the appropiate exit code. We check if the code read is an interactive command or statements is by checking for NewLine If the code contains NewLine, it's a set of statements (most probably from SendToConsole) If the code does not contain a NewLine, it's an interactive command typed by the user at the prompt

Shutdown ( ) : void
TreatAsBlankLine ( string line, int autoIndentSize ) : bool

Private helper function to see if we should treat the current input as a blank link. We do this if we only have auto-indent text.

Описание методов

CommandLine() публичный Метод

public CommandLine ( ) : System
Результат System

CreateCommandDispatcher() защищенный Метод

protected CreateCommandDispatcher ( ) : ICommandDispatcher
Результат ICommandDispatcher

CreateScope() защищенный Метод

protected CreateScope ( ) : Scope
Результат Microsoft.Scripting.Runtime.Scope

ExecuteCommand() защищенный Метод

protected ExecuteCommand ( ScriptSource source ) : object
source ScriptSource
Результат object

ExecuteCommand() защищенный Метод

protected ExecuteCommand ( string command ) : void
command string
Результат void

GetCommandProperties() защищенный Метод

protected GetCommandProperties ( string code ) : ScriptCodeParseResult
code string
Результат ScriptCodeParseResult

GetGlobals() публичный Метод

public GetGlobals ( string name ) : IList
name string
Результат IList

GetMemberNames() публичный Метод

public GetMemberNames ( string code ) : IList
code string
Результат IList

GetNextAutoIndentSize() защищенный Метод

Gets the next level for auto-indentation
protected GetNextAutoIndentSize ( string text ) : int
text string
Результат int

GetOutputWriter() защищенный Метод

protected GetOutputWriter ( bool isErrorOutput ) : TextWriter
isErrorOutput bool
Результат System.IO.TextWriter

Initialize() защищенный Метод

protected Initialize ( ) : void
Результат void

PrintLogo() защищенный Метод

protected PrintLogo ( ) : void
Результат void

ReadLine() защищенный Метод

protected ReadLine ( int autoIndentSize ) : string
autoIndentSize int
Результат string

ReadStatement() защищенный Метод

Read a statement, which can potentially be a multiple-line statement suite (like a class declaration).
protected ReadStatement ( bool &continueInteraction ) : string
continueInteraction bool Should the console session continue, or did the user indicate /// that it should be terminated?
Результат string

Run() защищенный Метод

Runs the command line. Languages can override this to provide custom behavior other than: 1. Running a single command 2. Running a file 3. Entering the interactive console loop.
protected Run ( ) : int
Результат int

Run() публичный Метод

Executes the comand line - depending upon the options provided we will either run a single file, a single command, or enter the interactive loop.
public Run ( ScriptEngine engine, IConsole console, ConsoleOptions options ) : void
engine ScriptEngine
console IConsole
options ConsoleOptions
Результат void

RunCommand() защищенный Метод

protected RunCommand ( string command ) : int
command string
Результат int

RunFile() защищенный Метод

protected RunFile ( string fileName ) : int
fileName string
Результат int

RunInteractive() защищенный Метод

Starts the interactive loop. Performs any initialization necessary before starting the loop and then calls RunInteractiveLoop to start the loop. Returns the exit code when the interactive loop is completed.
protected RunInteractive ( ) : int
Результат int

Terminate() публичный Метод

public Terminate ( int exitCode ) : void
exitCode int
Результат void

TryInteractiveAction() защищенный Метод

Attempts to run a single interaction and handle any language-specific exceptions. Base classes can override this and call the base implementation surrounded with their own exception handling. Returns null if successful and execution should continue, or an exit code.
protected TryInteractiveAction ( ) : int?
Результат int?

UnhandledException() защищенный Метод

protected UnhandledException ( Exception e ) : void
e System.Exception
Результат void