/// <summary>
        /// 文字入力モードの処理を行う
        /// ※文字入力モードでは常にtrueを返却する
        /// </summary>
        /// <param name="context"></param>
        /// <returns>true:処理の続行、false:処理の終了</returns>
        internal override bool Execute(Context context)
        {
            // 文字入力を受け付ける
            var str = Console.ReadLine();

            context.m_strInputName = str;
            // Commandを実行
            base.m_command.CallExecute(context, null);
            // 実行後、クリア
            context.m_strInputName = null;
            // キー入力モードを設定し、処理の継続を返却
            context.SetState(KeyInputStateInvoker.GetInstance());

            return(true);
        }
Example #2
0
        /// <summary>
        /// コンストラクタ
        /// MemoTreeの起動を行う
        /// </summary>
        public Context()
        {
            // MemoTreeディレクトリの存在チェック
            var strInitPath = Directory.GetCurrentDirectory() + "/MemoTree";

            if (!Directory.Exists(strInitPath))
            {
                Directory.CreateDirectory(strInitPath);
            }
            this.m_componentMain = new DirComponent(strInitPath);
            // 全ディレクトリ、ファイルを再帰的に取得
            DirComponent.SetComponent(this.m_componentMain);
            this.m_currentComponent = this.m_componentMain;

            // 起動時はキー入力モードを設定
            this.m_stateInvoker = KeyInputStateInvoker.GetInstance();
            // 起動時はEnterコマンドを直接実行
            var enterCommand = new EnterCommand();

            enterCommand.CallExecute(this, this.m_componentMain, false);
        }