コード例 #1
0
        public void PerformAction(VTActions vtAction, params object[] param)
        {
            switch (vtAction)
            {
            case VTActions.Print:
            {
                string text = param[0].ToString();

                this.currentLine.AppendText(text);
                this.currentLine.PerformRender();

                break;
            }

            case VTActions.CarriageReturn:
            {
                break;
            }

            case VTActions.LineFeed:
            {
                this.currentLine = this.RenderLine(string.Empty);
                break;
            }

            default:
                logger.WarnFormat("未处理的VTAction, {0}", vtAction);
                break;
            }
        }
コード例 #2
0
ファイル: VTParser.cs プロジェクト: 294797392/terminal
 private void NotifyActionEvent(VTActions vtAction, params object[] param)
 {
     if (this.ActionEvent != null)
     {
         this.ActionEvent(vtAction, param);
     }
 }
コード例 #3
0
ファイル: Terminal.cs プロジェクト: 294797392/terminal
        public void PerformAction(VTActions vtAction, params object[] param)
        {
            this.Dispatcher.Invoke(new Action(() =>
            {
                switch (vtAction)
                {
                case VTActions.PlayBell:
                    {
                        // 播放响铃
                        break;
                    }

                default:
                    {
                        this.visualContainer.PerformAction(vtAction, param);
                        break;
                    }
                }
            }));
        }
コード例 #4
0
        //public void PerformAction(List<VTActions> vtActions)
        //{
        //    foreach (VTAction vtAction in vtActions)
        //    {
        //        switch (vtAction.Type)
        //        {
        //            case VTActions.Foreground:
        //                {
        //                    switch ((TextColor)vtAction.Data)
        //                    {
        //                        case TextColor.DARK_BLACK: Console.ForegroundColor = ConsoleColor.Black; break;
        //                        case TextColor.DARK_BLUE: Console.ForegroundColor = ConsoleColor.DarkBlue; break;
        //                        case TextColor.DARK_CYAN: Console.ForegroundColor = ConsoleColor.DarkCyan; break;
        //                        case TextColor.DARK_GREEN: Console.ForegroundColor = ConsoleColor.DarkGreen; break;
        //                        case TextColor.DARK_MAGENTA: Console.ForegroundColor = ConsoleColor.DarkMagenta; break;
        //                        case TextColor.DARK_RED: Console.ForegroundColor = ConsoleColor.DarkRed; break;
        //                        case TextColor.DARK_WHITE: Console.ForegroundColor = ConsoleColor.White; break;
        //                        case TextColor.DARK_YELLOW: Console.ForegroundColor = ConsoleColor.DarkYellow; break;
        //                        case TextColor.BRIGHT_BLACK: Console.ForegroundColor = ConsoleColor.Black; break;
        //                        case TextColor.BRIGHT_BLUE: Console.ForegroundColor = ConsoleColor.Blue; break;
        //                        case TextColor.BRIGHT_CYAN: Console.ForegroundColor = ConsoleColor.Cyan; break;
        //                        case TextColor.BRIGHT_GREEN: Console.ForegroundColor = ConsoleColor.Green; break;
        //                        case TextColor.BRIGHT_MAGENTA: Console.ForegroundColor = ConsoleColor.Magenta; break;
        //                        case TextColor.BRIGHT_RED: Console.ForegroundColor = ConsoleColor.Red; break;
        //                        case TextColor.BRIGHT_WHITE: Console.ForegroundColor = ConsoleColor.White; break;
        //                        case TextColor.BRIGHT_YELLOW: Console.ForegroundColor = ConsoleColor.Yellow; break;
        //                        default:
        //                            break;
        //                    }
        //                    break;
        //                }

        //            case VTActions.Background:
        //                {
        //                    switch ((TextColor)vtAction.Data)
        //                    {
        //                        case TextColor.DARK_BLACK: Console.BackgroundColor = ConsoleColor.Black; break;
        //                        case TextColor.DARK_BLUE: Console.BackgroundColor = ConsoleColor.DarkBlue; break;
        //                        case TextColor.DARK_CYAN: Console.BackgroundColor = ConsoleColor.DarkCyan; break;
        //                        case TextColor.DARK_GREEN: Console.BackgroundColor = ConsoleColor.DarkGreen; break;
        //                        case TextColor.DARK_MAGENTA: Console.BackgroundColor = ConsoleColor.DarkMagenta; break;
        //                        case TextColor.DARK_RED: Console.BackgroundColor = ConsoleColor.DarkRed; break;
        //                        case TextColor.DARK_WHITE: Console.BackgroundColor = ConsoleColor.White; break;
        //                        case TextColor.DARK_YELLOW: Console.BackgroundColor = ConsoleColor.DarkYellow; break;
        //                        case TextColor.BRIGHT_BLACK: Console.BackgroundColor = ConsoleColor.Black; break;
        //                        case TextColor.BRIGHT_BLUE: Console.BackgroundColor = ConsoleColor.Blue; break;
        //                        case TextColor.BRIGHT_CYAN: Console.BackgroundColor = ConsoleColor.Cyan; break;
        //                        case TextColor.BRIGHT_GREEN: Console.BackgroundColor = ConsoleColor.Green; break;
        //                        case TextColor.BRIGHT_MAGENTA: Console.BackgroundColor = ConsoleColor.Magenta; break;
        //                        case TextColor.BRIGHT_RED: Console.BackgroundColor = ConsoleColor.Red; break;
        //                        case TextColor.BRIGHT_WHITE: Console.BackgroundColor = ConsoleColor.White; break;
        //                        case TextColor.BRIGHT_YELLOW: Console.BackgroundColor = ConsoleColor.Yellow; break;
        //                        default:
        //                            break;
        //                    }
        //                    break;
        //                }

        //            case VTActions.ForegroundRGB:
        //                {
        //                    break;
        //                }

        //            case VTActions.BackgroundRGB:
        //                {
        //                    break;
        //                }

        //            case VTActions.Blink:
        //                {
        //                    Console.CursorVisible = true;
        //                    break;
        //                }

        //            case VTActions.BlinkUnset:
        //                {
        //                    Console.CursorVisible = false;
        //                    break;
        //                }

        //            case VTActions.Bold:
        //                {
        //                    break;
        //                }

        //            case VTActions.BoldUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.CrossedOut:
        //                {
        //                    break;
        //                }

        //            case VTActions.CrossedOutUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.DefaultAttributes:
        //                {
        //                    break;
        //                }

        //            case VTActions.DefaultBackground:
        //                {
        //                    Console.BackgroundColor = this.defaultBackground;
        //                    break;
        //                }

        //            case VTActions.DefaultForeground:
        //                {
        //                    Console.ForegroundColor = this.defaultForeground;
        //                    break;
        //                }

        //            case VTActions.DoublyUnderlined:
        //                {
        //                    break;
        //                }

        //            case VTActions.DoublyUnderlinedUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.Faint:
        //                {
        //                    break;
        //                }

        //            case VTActions.FaintUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.Invisible:
        //                {
        //                    break;
        //                }

        //            case VTActions.InvisibleUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.Italics:
        //                {
        //                    break;
        //                }

        //            case VTActions.ItalicsUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.Overlined:
        //                {
        //                    break;
        //                }

        //            case VTActions.OverlinedUnset:
        //                {
        //                    break;
        //                }

        //            case VTActions.ReverseVideo:
        //                {
        //                    this.originalBackground = Console.BackgroundColor;
        //                    this.originalForeground = Console.ForegroundColor;

        //                    Console.BackgroundColor = this.originalForeground;
        //                    Console.ForegroundColor = this.originalBackground;
        //                    break;
        //                }

        //            case VTActions.ReverseVideoUnset:
        //                {
        //                    Console.BackgroundColor = this.originalBackground;
        //                    Console.ForegroundColor = this.originalForeground;
        //                    break;
        //                }

        //            case VTActions.Underline:
        //                {
        //                    break;
        //                }

        //            case VTActions.UnderlineUnset:
        //                {
        //                    break;
        //                }

        //            default:
        //                break;
        //        }
        //    }
        //}

        public void PerformAction(VTActions vtAction, params object[] param)
        {
        }
コード例 #5
0
 private void VtParser_ActionEvent(VTActions action, params object[] param)
 {
     this.terminal.PerformAction(action, param);
 }