|
@@ -1,4 +1,6 @@
|
|
|
using System;
|
|
using System;
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
+using System.Linq;
|
|
|
using System.Reflection;
|
|
using System.Reflection;
|
|
|
using System.Xml.XPath;
|
|
using System.Xml.XPath;
|
|
|
|
|
|
|
@@ -8,6 +10,9 @@ namespace Quadarax.Foundation.QConsole.Configuration
|
|
|
{
|
|
{
|
|
|
#region *** Private Fields ***
|
|
#region *** Private Fields ***
|
|
|
private bool _isConsoleDebug;
|
|
private bool _isConsoleDebug;
|
|
|
|
|
+ private string[] _defaultCommands = {"CmdClear", "CmdExit", "CmdPrint", "CmdSelection"};
|
|
|
|
|
+
|
|
|
|
|
+ private readonly IList<string> _disabledCommands = new List<string>();
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region *** Properties ***
|
|
#region *** Properties ***
|
|
@@ -75,9 +80,9 @@ namespace Quadarax.Foundation.QConsole.Configuration
|
|
|
public Assembly[] CommandDefinitionAssebmly { get; set; }
|
|
public Assembly[] CommandDefinitionAssebmly { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// Defines if default (build-in) commands CLEAR,EXIT,PRINT,SELECTION will be disabled (hidden).
|
|
|
|
|
|
|
+ /// Returns name of command classes that will be disabled (hidden)
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public bool DisableDefaultCommands { get; set; }
|
|
|
|
|
|
|
+ public string[] DisabledCommands => _disabledCommands.ToArray();
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Defines if waits on key at the end of process in non-interactive mode (inline mode)
|
|
/// Defines if waits on key at the end of process in non-interactive mode (inline mode)
|
|
@@ -131,6 +136,43 @@ namespace Quadarax.Foundation.QConsole.Configuration
|
|
|
IsConsoleDebug = false;
|
|
IsConsoleDebug = false;
|
|
|
return this;
|
|
return this;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public StartupConfiguration DisableDefaultCommands()
|
|
|
|
|
+ {
|
|
|
|
|
+ return DisableCommands(_defaultCommands);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public StartupConfiguration EnableDefaultCommands()
|
|
|
|
|
+ {
|
|
|
|
|
+ return EnableCommands(_defaultCommands);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public StartupConfiguration EnableCommands(params string[] commandClassNames)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (commandClassNames == null)
|
|
|
|
|
+ return this;
|
|
|
|
|
+
|
|
|
|
|
+ foreach (var className in commandClassNames)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (_disabledCommands.Contains(className))
|
|
|
|
|
+ _disabledCommands.Remove(className);
|
|
|
|
|
+ }
|
|
|
|
|
+ return this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public StartupConfiguration DisableCommands(params string[] commandClassNames)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (commandClassNames == null)
|
|
|
|
|
+ return this;
|
|
|
|
|
+ foreach (var className in commandClassNames)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!_disabledCommands.Contains(className))
|
|
|
|
|
+ _disabledCommands.Add(className);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region *** Private Operations ***
|
|
#region *** Private Operations ***
|
|
@@ -149,7 +191,6 @@ namespace Quadarax.Foundation.QConsole.Configuration
|
|
|
AllowInteractive = Defaults.Console.InteractiveAllowed;
|
|
AllowInteractive = Defaults.Console.InteractiveAllowed;
|
|
|
AllowPreset = Defaults.Console.PresetAllowed;
|
|
AllowPreset = Defaults.Console.PresetAllowed;
|
|
|
IsConsoleDebug = Defaults.Console.ConsoleDebugMode;
|
|
IsConsoleDebug = Defaults.Console.ConsoleDebugMode;
|
|
|
- DisableDefaultCommands = Defaults.Console.DisableDefaultCommands;
|
|
|
|
|
WaitOnKeyInNonInteractiveMode = Defaults.Console.WaitOnKeyInNonInteractiveMode;
|
|
WaitOnKeyInNonInteractiveMode = Defaults.Console.WaitOnKeyInNonInteractiveMode;
|
|
|
|
|
|
|
|
}
|
|
}
|