コード例 #1
0
ファイル: terminal.cs プロジェクト: mertcandav/MochaDBStudio
        /// <summary>
        /// Process command.
        /// </summary>
        public void ProcessCommand()
        {
            string tInput = Input.TrimStart().TrimEnd();

            var result =
                from value in BannedCommandNamespaces
                where tInput.StartsWith(value)
                select value;

            if (result.Count() > 0)
            {
                TerminalErrorEcho("Can't use this command namespace in this terminal!");
                return;
            }

            TerminalInputProcessEventArgs args = new TerminalInputProcessEventArgs(tInput);

            OnInputProcessing(this, args);
            if (args.Cancel)
            {
                return;
            }

            AddInput(new TerminalInput(CurrentTitle.Base, Input, BaseFont, InputFont), true);

            if (!string.IsNullOrEmpty(tInput))
            {
                if (tInput == "clear")
                {
                    Clear();
                    return;
                }
                else if (tInput.StartsWith("release"))
                {
                    release(tInput);
                }
                else if (tInput.StartsWith("cnc"))
                {
                    cnc(tInput);
                }
                else if (Database != null)
                {
                    mochaq(tInput);
                }
                else
                {
                    AddInput(new TerminalInput(CurrentTitle.Base, "Command is not found!", Color.Red, BaseFont, InputFont), false);
                }
            }
        }
コード例 #2
0
ファイル: terminal.cs プロジェクト: mertcandav/MochaDBStudio
 private void OnInputProcessing(object sender, TerminalInputProcessEventArgs e)
 {
     //Invoke.
     InputProcessing?.Invoke(sender, e);
 }