本文整理汇总了C#中ITerminal.WriteTo方法的典型用法代码示例。如果您正苦于以下问题:C# ITerminal.WriteTo方法的具体用法?C# ITerminal.WriteTo怎么用?C# ITerminal.WriteTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITerminal
的用法示例。
在下文中一共展示了ITerminal.WriteTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public string Parse(
ITerminal Terminal,
string Command,
ref string[] Arguments)
{
string commandName = null;
ParsedCommandLine Parsed = new ParsedCommandLine( Command );
bool bParsed = Parsed.Parse();
if ( ! bParsed )
{
Terminal.WriteTo( new StringBuilder( "Failed to parse\n" ), ConsoleProcessRedirection.OutputType.StandardError );
}
else
{
Parsed.Print( Terminal );
}
Command = Command.TrimStart(' ','\t');
Command = Command.TrimEnd(' ','\t');
if ( Command.Length > 0 )
{
Arguments = Command.Split( new char[] {' ','\t'} );
if ( Arguments[0].ToLower().StartsWith("cd\\") )
{
string[] NewArguments = new string[ Arguments.Length + 1 ];
NewArguments[0] = Arguments[0].Substring( 0, 2 );
NewArguments[1] = Arguments[0].Substring( 2, Arguments[0].Length - 2 );
if ( Arguments.Length > 1 )
{
NewArguments[1] += Arguments[1];
for ( int Argument = 1; Argument < Arguments.Length; Argument++ )
{
NewArguments[ Argument + 1 ] = Arguments[ Argument ];
}
}
Arguments = NewArguments;
}
commandName = Arguments[0].ToLower();
}
return commandName;
}
示例2: Print
public void Print( ITerminal Terminal )
{
lock( this )
{
Terminal.WriteTo( new StringBuilder("\n"), OutputType.StandardOutput );
if ( _bEmptyLine )
{
Terminal.WriteTo( new StringBuilder("<emptyline>\n"), Color.Blue, OutputType.StandardOutput );
return;
}
if ( null != _InputFile )
{
StringBuilder InputFile = new StringBuilder( _InputFile );
Terminal.WriteTo( InputFile, Color.Magenta, OutputType.StandardOutput );
Terminal.WriteTo( new StringBuilder(" < "), OutputType.StandardOutput );
}
if ( null != _CommandList )
{
StringBuilder CommandList = new StringBuilder( _CommandList );
Terminal.WriteTo( CommandList, Color.Blue, OutputType.StandardOutput );
}
if ( null != _OutputFile )
{
StringBuilder OutputFile = new StringBuilder( _OutputFile );
Terminal.WriteTo( new StringBuilder(" > "), OutputType.StandardOutput );
Terminal.WriteTo( OutputFile, Color.Magenta, OutputType.StandardOutput );
}
if ( null != _ParsedCommand )
{
Terminal.WriteTo( new StringBuilder("\n"), OutputType.StandardOutput );
StringBuilder ParsedCommand = new StringBuilder( _ParsedCommand );
Terminal.WriteTo( ParsedCommand, Color.Green, OutputType.StandardOutput );
}
Terminal.WriteTo( new StringBuilder("\n"), OutputType.StandardOutput );
}
}
示例3: WriteText
public static void WriteText(
ITerminal Terminal,
string Text)
{
StringBuilder NewText = new StringBuilder( Text );
try
{
Terminal.WriteTo( NewText, OutputType.StandardOutput );
}
catch
{
}
}