diff --git a/Galactic Colors Control Server/Commands/ClearCommand.cs b/Galactic Colors Control Server/Commands/ClearCommand.cs index 7ae4885..98e9dba 100644 --- a/Galactic Colors Control Server/Commands/ClearCommand.cs +++ b/Galactic Colors Control Server/Commands/ClearCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /clear to execute Console.Clear()."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return true; } } + public bool IsClientSide { get { return true; } } public bool IsNoConnect { get { return true; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/CloseCommand.cs b/Galactic Colors Control Server/Commands/CloseCommand.cs index 1724d31..9129e77 100644 --- a/Galactic Colors Control Server/Commands/CloseCommand.cs +++ b/Galactic Colors Control Server/Commands/CloseCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /close to stop connection process"; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/ConnectCommand.cs b/Galactic Colors Control Server/Commands/ConnectCommand.cs index 34ff25a..5253864 100644 --- a/Galactic Colors Control Server/Commands/ConnectCommand.cs +++ b/Galactic Colors Control Server/Commands/ConnectCommand.cs @@ -11,6 +11,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /connect [username] to start identification"; } } public bool IsServer { get { return false; } } public bool IsClient { get { return true; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return true; } } public int minArgs { get { return 1; } } public int maxArgs { get { return 1; } } diff --git a/Galactic Colors Control Server/Commands/CountCommand.cs b/Galactic Colors Control Server/Commands/CountCommand.cs index 3be6f3b..e650b93 100644 --- a/Galactic Colors Control Server/Commands/CountCommand.cs +++ b/Galactic Colors Control Server/Commands/CountCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /count to show connected clients count and size"; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/ExitCommand.cs b/Galactic Colors Control Server/Commands/ExitCommand.cs index 13243c8..1066302 100644 --- a/Galactic Colors Control Server/Commands/ExitCommand.cs +++ b/Galactic Colors Control Server/Commands/ExitCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /exit to stop actual program."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return true; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return true; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/HelpCommand.cs b/Galactic Colors Control Server/Commands/HelpCommand.cs index de14d7f..0e8a419 100644 --- a/Galactic Colors Control Server/Commands/HelpCommand.cs +++ b/Galactic Colors Control Server/Commands/HelpCommand.cs @@ -12,6 +12,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /help [command] to display command help."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return true; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 1; } } diff --git a/Galactic Colors Control Server/Commands/ICommand.cs b/Galactic Colors Control Server/Commands/ICommand.cs index d1f2cb9..63cb3c8 100644 --- a/Galactic Colors Control Server/Commands/ICommand.cs +++ b/Galactic Colors Control Server/Commands/ICommand.cs @@ -9,6 +9,7 @@ namespace Galactic_Colors_Control_Server.Commands string HelpText { get; } bool IsServer { get; } bool IsClient { get; } + bool IsClientSide { get; } bool IsNoConnect { get; } int minArgs { get; } int maxArgs { get; } diff --git a/Galactic Colors Control Server/Commands/KickCommand.cs b/Galactic Colors Control Server/Commands/KickCommand.cs index ae52094..ac7a75b 100644 --- a/Galactic Colors Control Server/Commands/KickCommand.cs +++ b/Galactic Colors Control Server/Commands/KickCommand.cs @@ -12,6 +12,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /kick [username] to kick client from server."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return true; } } public int minArgs { get { return 1; } } public int maxArgs { get { return 2; } } diff --git a/Galactic Colors Control Server/Commands/ListCommand.cs b/Galactic Colors Control Server/Commands/ListCommand.cs index 76b2c63..244fa6a 100644 --- a/Galactic Colors Control Server/Commands/ListCommand.cs +++ b/Galactic Colors Control Server/Commands/ListCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /list to display all connected client username or IP."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/LogLevelCommand.cs b/Galactic Colors Control Server/Commands/LogLevelCommand.cs index 4c78019..87b3055 100644 --- a/Galactic Colors Control Server/Commands/LogLevelCommand.cs +++ b/Galactic Colors Control Server/Commands/LogLevelCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /loglevel [loglevel] to change Loglevel."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return true; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 1; } } public int maxArgs { get { return 1; } } diff --git a/Galactic Colors Control Server/Commands/Manager.cs b/Galactic Colors Control Server/Commands/Manager.cs index 674e173..aaa773f 100644 --- a/Galactic Colors Control Server/Commands/Manager.cs +++ b/Galactic Colors Control Server/Commands/Manager.cs @@ -35,22 +35,30 @@ namespace Galactic_Colors_Control_Server.Commands if (commands.ContainsKey(args[0])) { ICommand command = commands[args[0]]; - if (CanAccess(command,soc,server)) + if (CanAccess(command, soc, server)) { - if(args.Length > command.minArgs) + if (command.IsClientSide) { - if(args.Length - 1 <= command.maxArgs) - { - command.Execute(args, soc, server); - } - else - { - Utilities.Return("Command " + command.Name + " require at most " + command.minArgs + " argument(s).", soc, server); - } + Utilities.Return("It's a client side command", soc, server); } else { - Utilities.Return("Command " + command.Name + " require at least " + command.minArgs + " argument(s).", soc, server); + if (args.Length > command.minArgs) + { + if (args.Length - 1 <= command.maxArgs) + { + command.Execute(args, soc, server); + } + else + { + Utilities.Return("Command " + command.Name + " require at most " + command.minArgs + " argument(s).", soc, server); + } + } + + else + { + Utilities.Return("Command " + command.Name + " require at least " + command.minArgs + " argument(s).", soc, server); + } } } else diff --git a/Galactic Colors Control Server/Commands/OpenCommand.cs b/Galactic Colors Control Server/Commands/OpenCommand.cs index 714a55f..3eee375 100644 --- a/Galactic Colors Control Server/Commands/OpenCommand.cs +++ b/Galactic Colors Control Server/Commands/OpenCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /open to restart connection process"; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/PingCommand.cs b/Galactic Colors Control Server/Commands/PingCommand.cs index c651c65..3938c37 100644 --- a/Galactic Colors Control Server/Commands/PingCommand.cs +++ b/Galactic Colors Control Server/Commands/PingCommand.cs @@ -9,13 +9,14 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /ping to display our ping."; } } public bool IsServer { get { return false; } } public bool IsClient { get { return true; } } + public bool IsClientSide { get { return true; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } public void Execute(string[] args, Socket soc, bool server = false) { - Utilities.Return("It's a client side command" ,soc ,server); + } } } diff --git a/Galactic Colors Control Server/Commands/StatusCommand.cs b/Galactic Colors Control Server/Commands/StatusCommand.cs index 6446ea1..57fcd7a 100644 --- a/Galactic Colors Control Server/Commands/StatusCommand.cs +++ b/Galactic Colors Control Server/Commands/StatusCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /status to display server actual status."; } } public bool IsServer { get { return true; } } public bool IsClient { get { return false; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } } diff --git a/Galactic Colors Control Server/Commands/TimeCommand.cs b/Galactic Colors Control Server/Commands/TimeCommand.cs index 6e4bacb..98d3a00 100644 --- a/Galactic Colors Control Server/Commands/TimeCommand.cs +++ b/Galactic Colors Control Server/Commands/TimeCommand.cs @@ -10,6 +10,7 @@ namespace Galactic_Colors_Control_Server.Commands public string HelpText { get { return "Use /time to display server time. (format is server dependent)"; } } public bool IsServer { get { return true; } } public bool IsClient { get { return true; } } + public bool IsClientSide { get { return false; } } public bool IsNoConnect { get { return false; } } public int minArgs { get { return 0; } } public int maxArgs { get { return 0; } }