示例#1
0
        public void Recognize()
        {
            if (_promptExpression == null)
            {
                return;
            }
            if (_terminal.TerminalMode == TerminalMode.Application)
            {
                return; //アプリケーションモードは通知の必要なし
            }
            //一応、前回チェック時とデータ受信の有無をもらってくれば処理の簡略化は可能

            TerminalDocument doc = _terminal.GetDocument();
            int maxLines         = PromptRecognizerPreferences.Instance.PromptSearchMaxLines;

            _lineCache.Extend(maxLines);
            GLine promptCandidate = FindPromptCandidateLine(doc, maxLines);

            if (promptCandidate == null)
            {
                return; // too large command line
            }
            string prompt;
            string command;

            if (!DeterminePromptLine(promptCandidate, doc.CurrentLine.ID, doc.CaretColumn, out prompt, out command))   //プロンプトではないとき
            {
                NotifyNotPromptLine();
            }
            else
            {
                Debug.WriteLineIf(DebugOpt.PromptRecog, "Prompt " + command);
                NotifyPromptLine(promptCandidate, prompt, command);
            }
        }