Ajout de verification IsClientSide
This commit is contained in:
parent
0f42c0b39e
commit
b3783627ba
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
public string HelpText { get { return "Use /kick [username] <reason> 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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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; } }
|
||||
|
|
|
@ -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; } }
|
||||
|
|
Reference in New Issue