当前位置: 首页>>代码示例>>C#>>正文


C# ITerminal.WriteTo方法代码示例

本文整理汇总了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;
        }
开发者ID:adamedx,项目名称:shango,代码行数:53,代码来源:DefaultCommandParser.cs

示例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 );
            }
        }
开发者ID:adamedx,项目名称:shango,代码行数:47,代码来源:ParsedCommandLine.cs

示例3: WriteText

        public static void WriteText( 
            ITerminal Terminal,
            string    Text)
        {
            StringBuilder NewText = new StringBuilder( Text );

            try
            {
                Terminal.WriteTo( NewText, OutputType.StandardOutput );
            }
            catch
            {
            }
        }
开发者ID:adamedx,项目名称:shango,代码行数:14,代码来源:Terminal.cs


注:本文中的ITerminal.WriteTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。