Fixed some display bugs
This commit is contained in:
@@ -78,7 +78,8 @@ public class Program
|
|||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
var cmd = Console.ReadLine();
|
var cmd = Console.ReadLine();
|
||||||
consoleCommandsHandler.HandleCommand(cmd);
|
if (!consoleCommandsHandler.HandleCommand(cmd))
|
||||||
|
Console.WriteLine("Failed to run command " + cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ namespace PluginManager
|
|||||||
|
|
||||||
public static bool RemoveKey(string key)
|
public static bool RemoveKey(string key)
|
||||||
{
|
{
|
||||||
|
if (key == "Version" || key == "token" || key == "prefix") return false;
|
||||||
appConfig!.ApplicationVariables!.Remove(key);
|
appConfig!.ApplicationVariables!.Remove(key);
|
||||||
appConfig.ProtectedKeyWords!.Remove(key);
|
appConfig.ProtectedKeyWords!.Remove(key);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public class ConsoleCommandsHandler
|
|||||||
foreach (var command in commandList)
|
foreach (var command in commandList)
|
||||||
if (command.CommandName == args[1])
|
if (command.CommandName == args[1])
|
||||||
{
|
{
|
||||||
Console.WriteLine(command.Description);
|
Console.WriteLine("Command description: " + command.Description);
|
||||||
Console.WriteLine(command.Usage);
|
Console.WriteLine("Command execution format:" + command.Usage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,12 +286,25 @@ public class ConsoleCommandsHandler
|
|||||||
return commandList.FirstOrDefault(t => t.CommandName == command);
|
return commandList.FirstOrDefault(t => t.CommandName == command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleCommand(string command)
|
public bool HandleCommand(string command, bool removeCommandExecution = true)
|
||||||
{
|
{
|
||||||
var args = command.Split(' ');
|
var args = command.Split(' ');
|
||||||
foreach (var item in commandList.ToList())
|
foreach (var item in commandList.ToList())
|
||||||
if (item.CommandName == args[0])
|
if (item.CommandName == args[0])
|
||||||
|
{
|
||||||
|
if (removeCommandExecution)
|
||||||
|
{
|
||||||
|
Console.SetCursorPosition(0, Console.CursorTop - 1);
|
||||||
|
for (int i = 0; i < command.Length; i++) Console.Write(" ");
|
||||||
|
Console.SetCursorPosition(0, Console.CursorTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
item.Action(args);
|
item.Action(args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
//Console.WriteLine($"Executing: {args[0]} with the following parameters: {args.MergeStrings(1)}");
|
//Console.WriteLine($"Executing: {args[0]} with the following parameters: {args.MergeStrings(1)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user