diff --git a/Galactic Colors Control GUI/Utilities.cs b/Galactic Colors Control GUI/Utilities.cs
index da28d29..c4f6be1 100644
--- a/Galactic Colors Control GUI/Utilities.cs
+++ b/Galactic Colors Control GUI/Utilities.cs
@@ -6,6 +6,11 @@ namespace Galactic_Colors_Control_GUI
{
static class Utilities
{
+ ///
+ /// Load Texture2D from files
+ ///
+ /// File .png path
+ /// Result sprite
static public void SpriteFromPng(string path, ref Texture2D sprite, GraphicsDevice graphics)
{
if (File.Exists(path))
@@ -17,6 +22,11 @@ namespace Galactic_Colors_Control_GUI
}
}
+ ///
+ /// Load SoundEffect from files
+ ///
+ /// File .mp3 path
+ /// Result sound
static public void SoundFromMp3(string path, ref SoundEffect sound)
{
if (File.Exists(path))
diff --git a/Galactic Colors Control Server/Commands/HelpCommand.cs b/Galactic Colors Control Server/Commands/HelpCommand.cs
index 1d5ffbe..9b3c502 100644
--- a/Galactic Colors Control Server/Commands/HelpCommand.cs
+++ b/Galactic Colors Control Server/Commands/HelpCommand.cs
@@ -9,7 +9,7 @@ namespace Galactic_Colors_Control_Server.Commands
{
public string Name { get { return "help"; } }
public string DescText { get { return "Shows the help."; } }
- public string HelpText { get { return "Use /help [command] to display command help."; } }
+ public string HelpText { get { return "Use /help [command] to display command help. (-all for full help)"; } }
public Manager.CommandGroup Group { get { return Manager.CommandGroup.root; } }
public bool IsServer { get { return true; } }
public bool IsClient { get { return true; } }
@@ -20,7 +20,14 @@ namespace Galactic_Colors_Control_Server.Commands
public void Execute(string[] args, Socket soc, bool server = false)
{
- if(args.Length == 1)
+ bool isGroup = false;
+ bool isAll = false;
+ if (args.Length == 2)
+ {
+ isGroup = Enum.GetNames(typeof(Manager.CommandGroup)).Contains(args[1]);
+ isAll = (args[1] == "-all");
+ }
+ if (args.Length == 1 || (isGroup || isAll))
{
int maxLen = 0;
List list = new List();
@@ -28,8 +35,11 @@ namespace Galactic_Colors_Control_Server.Commands
{
if(Manager.CanAccess(com, soc, server))
{
- list.Add(com);
- if(com.Name.Length + (com.Group == 0 ? 0 : 4) > maxLen) { maxLen = com.Name.Length + (com.Group == 0 ? 0 : 4); }
+ if (!isGroup || (isGroup && com.Group == (Manager.CommandGroup)Enum.Parse(typeof(Manager.CommandGroup), args[1])))
+ {
+ list.Add(com);
+ if (com.Name.Length + (com.Group == 0 ? 0 : 4) > maxLen) { maxLen = com.Name.Length + (com.Group == 0 ? 0 : 4); }
+ }
}
}
list.Sort((x,y) => x.Group.CompareTo(y.Group));
@@ -39,10 +49,13 @@ namespace Galactic_Colors_Control_Server.Commands
{
if(com.Group != actualGroup)
{
- text += (Environment.NewLine + " " + com.Group.ToString() + Environment.NewLine);
+ text += (Environment.NewLine + " " + com.Group.ToString() + Environment.NewLine + ((isGroup || isAll) ? "" : (" Use /help " + com.Group.ToString())));
actualGroup = com.Group;
}
- text += (" " + (com.Group != 0 ? new string(' ',4) : "") + com.Name + new string(' ', maxLen - com.Name.Length - (com.Group == 0 ? 0 : 4)) + " : " + com.DescText + Environment.NewLine);
+ if ((!(isGroup || isAll) && com.Group == 0) || (isGroup || isAll))
+ {
+ text += (" " + (com.Group != 0 ? new string(' ', 4) : "") + com.Name + new string(' ', maxLen - com.Name.Length - (com.Group == 0 ? 0 : 4)) + " : " + com.DescText + Environment.NewLine);
+ }
}
Utilities.Return(text, soc, server);
}
diff --git a/Galactic Colors Control Server/Commands/Manager.cs b/Galactic Colors Control Server/Commands/Manager.cs
index f914e69..1554015 100644
--- a/Galactic Colors Control Server/Commands/Manager.cs
+++ b/Galactic Colors Control Server/Commands/Manager.cs
@@ -44,7 +44,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
- if (args.Length > command.minArgs)
+ if (args.Length - (command.Group == 0 ? 0 : 1) > command.minArgs)
{
if (args.Length - (command.Group == 0 ? 1 : 2) <= command.maxArgs)
{
@@ -52,7 +52,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
- Utilities.Return("Command " + CommandToString(command) + " require at most " + command.minArgs + " argument(s).", soc, server);
+ Utilities.Return("Command " + CommandToString(command) + " require at most " + command.maxArgs + " argument(s).", soc, server);
}
}
@@ -81,6 +81,10 @@ namespace Galactic_Colors_Control_Server.Commands
return text;
}
+ ///
+ /// Convert command args in readable string
+ ///
+ /// Command args
public static string CommandToString(string[] args)
{
if (args.Length > 0)
@@ -98,6 +102,12 @@ namespace Galactic_Colors_Control_Server.Commands
}
}
+ ///
+ /// Try to get a command
+ ///
+ /// command args
+ /// Command result
+ /// Correct command
public static bool TryGetCommand(string[] args, ref ICommand command)
{
if (args.Length > 0)
diff --git a/Galactic Colors Control Server/Commands/Party/PartyClientCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyClientCommand.cs
new file mode 100644
index 0000000..ac60f20
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyClientCommand.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyClientCommand : ICommand
+ {
+ public string Name { get { return "client"; } }
+ public string DescText { get { return "Lists party clients."; } }
+ public string HelpText { get { return "Use /party client to show party clients list."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, false, soc, server))
+ {
+ string text = " ";
+ foreach(Socket client in Program.parties[partyId].clients)
+ {
+ text += (Utilities.GetName(client) + Environment.NewLine + " ");
+ }
+ Utilities.Return(text, soc, server);
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyCloseCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyCloseCommand.cs
new file mode 100644
index 0000000..5591d62
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyCloseCommand.cs
@@ -0,0 +1,35 @@
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyCloseCommand : ICommand
+ {
+ public string Name { get { return "close"; } }
+ public string DescText { get { return "Closes party."; } }
+ public string HelpText { get { return "Use /party close to close party for join."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, true,soc, server))
+ {
+ if (Program.parties[partyId].open)
+ {
+ Program.parties[partyId].open = false;
+ Utilities.Return("Party closed", soc, server);
+ }
+ else
+ {
+ Utilities.Return("Party allready close", soc, server);
+ }
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyCreateCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyCreateCommand.cs
new file mode 100644
index 0000000..a194712
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyCreateCommand.cs
@@ -0,0 +1,62 @@
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyCreateCommand : ICommand
+ {
+ public string Name { get { return "create"; } }
+ public string DescText { get { return "Create new party."; } }
+ public string HelpText { get { return "Use /party create [name] [size] to create new party."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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 2; } }
+ public int maxArgs { get { return 2; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ if (server || (!server && Program.clients[soc].partyID == -1))
+ {
+ int size;
+ if (int.TryParse(args[3], out size))
+ {
+ if (size > 0)
+ {
+ if (size <= Program.config.size)
+ {
+ Logger.Write("Party " + args[2] + " create with " + size + " slots as " + Program.partyID, Logger.logType.info);
+ Program.AddParty(new Party(args[2], size, Utilities.GetName(soc)));
+ if (server)
+ {
+ Program.selectedParty = Program.partyID-1;
+ }
+ else
+ {
+ Program.clients[soc].partyID = Program.partyID-1;
+ Utilities.Return("Party " + args[2] + " create with " + size + " slots as " + (Program.partyID-1), soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Too big size", soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Too small size", soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Incorrect argument " + args[3], soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Allready in a party.", soc, server);
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyJoinCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyJoinCommand.cs
new file mode 100644
index 0000000..c259c51
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyJoinCommand.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyJoinCommand : ICommand
+ {
+ public string Name { get { return "join"; } }
+ public string DescText { get { return "Join a party."; } }
+ public string HelpText { get { return "Use /party join [id] to join a party."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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 1; } }
+ public int maxArgs { get { return 2; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ if ((server && Program.selectedParty == -1) || (!server && Program.clients[soc].partyID == -1))
+ {
+ int id;
+ if (int.TryParse(args[2], out id))
+ {
+ if (Program.parties.ContainsKey(id))
+ {
+ Party party = Program.parties[id];
+ if (args.Length == 3)
+ {
+ Array.Resize(ref args, 4);
+ args[3] = "";
+ }
+ if (server || (!server && party.TestPassword(args[3])))
+ {
+ if(server)
+ {
+ Program.selectedParty = id;
+ }
+ else
+ {
+ if(party.open)
+ {
+ if (party.clients.Count < party.size)
+ {
+ Program.clients[soc].partyID = id;
+ Utilities.BroadcastParty(Utilities.GetName(soc) + " join the party", Galactic_Colors_Control_Common.Common.dataType.message, id);
+ }
+ else
+ {
+ Utilities.Return("Party is full", soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Party close", soc, server);
+ }
+ }
+ }
+ else
+ {
+ Utilities.Return("Wrong party password", soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Can't find party " + id, soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Incorrect argument " + args[3], soc, server);
+ }
+ }
+ else
+ {
+ Utilities.Return("Allready in a party.", soc, server);
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyKickCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyKickCommand.cs
new file mode 100644
index 0000000..7d76903
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyKickCommand.cs
@@ -0,0 +1,49 @@
+using Galactic_Colors_Control_Common;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyKickCommand : ICommand
+ {
+ public string Name { get { return "kick"; } }
+ public string DescText { get { return "Kick player from party."; } }
+ public string HelpText { get { return "Use /party kick [name] to kick palyer from party"; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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 1; } }
+ public int maxArgs { get { return 2; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, true, soc, server))
+ {
+ Socket target = null;
+ foreach (Socket client in Program.parties[partyId].clients)
+ {
+ if (Utilities.GetName(client) == args[2]) { target = client; }
+ }
+ if (target != null)
+ {
+ Utilities.BroadcastParty(args[2] + " was kick", Common.dataType.message, partyId);
+ if (args.Length > 3)
+ {
+ Utilities.Send(target, "/party kick " + args[3], Common.dataType.message);
+ }
+ else
+ {
+ Utilities.Send(target, "/party kick", Common.dataType.message);
+ }
+ Manager.Execute(new string[2] { "party", "leave" },target,false);
+ }
+ else
+ {
+ Utilities.Return("Can't find " + args[2] + "in party", soc, server);
+ }
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyLeaveCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyLeaveCommand.cs
new file mode 100644
index 0000000..aa65bf7
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyLeaveCommand.cs
@@ -0,0 +1,42 @@
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyLeaveCommand : ICommand
+ {
+ public string Name { get { return "leave"; } }
+ public string DescText { get { return "Leave party."; } }
+ public string HelpText { get { return "Use /party leave to leave current party"; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ if (server)
+ {
+ Program.selectedParty = -1;
+ }
+ else
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, false, soc, server))
+ {
+ if (!Program.parties[partyId].IsOwner(Utilities.GetName(soc)))
+ {
+ Utilities.BroadcastParty(Utilities.GetName(soc) + " leave the party", Galactic_Colors_Control_Common.Common.dataType.message, partyId);
+ Program.clients[soc].partyID = -1;
+ }
+ else
+ {
+ Utilities.Return("Owner can't leave party. Look for /party stop", soc, server);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyListCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyListCommand.cs
new file mode 100644
index 0000000..27c486c
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyListCommand.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyListCommand : ICommand
+ {
+ public string Name { get { return "list"; } }
+ public string DescText { get { return "Shows parties list."; } }
+ public string HelpText { get { return "Use /party list to show parties list."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ string text = " ";
+ foreach (int key in Program.parties.Keys)
+ {
+ Party party = Program.parties[key];
+ text += (key + " : " + party.name + " : " + party.count + "/" + party.size + " : " + (party.open ? (party.isPrivate ? "private" : "open") : "close") + Environment.NewLine + " ");
+ }
+ Utilities.Return(text, soc, server);
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyOpenCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyOpenCommand.cs
new file mode 100644
index 0000000..627b9c2
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyOpenCommand.cs
@@ -0,0 +1,35 @@
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyOpenCommand : ICommand
+ {
+ public string Name { get { return "open"; } }
+ public string DescText { get { return "Opens party."; } }
+ public string HelpText { get { return "Use /party open to open party for join."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, true, soc, server))
+ {
+ if (!Program.parties[partyId].open)
+ {
+ Program.parties[partyId].open = true;
+ Utilities.Return("Party opened", soc, server);
+ }
+ else
+ {
+ Utilities.Return("Party allready open", soc, server);
+ }
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyPasswordCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyPasswordCommand.cs
new file mode 100644
index 0000000..e613d65
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyPasswordCommand.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyPasswordCommand : ICommand
+ {
+ public string Name { get { return "password"; } }
+ public string DescText { get { return "Set party password."; } }
+ public string HelpText { get { return "Use /party password [newPass] [oldPass] to set party private with password."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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 1; } }
+ public int maxArgs { get { return 2; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, true, soc, server))
+ {
+ if (args.Length == 3)
+ {
+ Array.Resize(ref args, 4);
+ args[3] = "";
+ }
+ if (Program.parties[partyId].SetPassword(args[2],args[3]))
+ {
+ Utilities.Return("Password changed", soc, server);
+ }
+ else
+ {
+ Utilities.Return("Can't change password", soc, server);
+ }
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyStatusCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyStatusCommand.cs
new file mode 100644
index 0000000..c4cfa92
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyStatusCommand.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyStatusCommand : ICommand
+ {
+ public string Name { get { return "status"; } }
+ public string DescText { get { return "Shows party status."; } }
+ public string HelpText { get { return "Use /party status to show party status."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, false, soc, server))
+ {
+ Party party = Program.parties[partyId];
+ string text = "";
+ text += ("Name: " + party.name + Environment.NewLine);
+ text += ("Count: " + party.count + "/" + party.size + Environment.NewLine);
+ text += ("Status: " + (party.isPrivate ? "private" : (party.open ? "open" : "close")));
+ Utilities.Return(text,soc,server);
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Party/PartyStopCommand.cs b/Galactic Colors Control Server/Commands/Party/PartyStopCommand.cs
new file mode 100644
index 0000000..1a9d7fe
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Party/PartyStopCommand.cs
@@ -0,0 +1,33 @@
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PartyStopCommand : ICommand
+ {
+ public string Name { get { return "stop"; } }
+ public string DescText { get { return "Stop party."; } }
+ public string HelpText { get { return "Use /party stop to stop current party"; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.party; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ int partyId = -1;
+ if (Utilities.AccessParty(ref partyId, true, soc, server))
+ {
+ foreach(Socket client in Program.parties[partyId].clients)
+ {
+ Manager.Execute(new string[4] { "party","kick",Utilities.GetName(client),"stop_party" } ,soc,server);
+ }
+ Logger.Write("Party " + Program.parties[partyId].name + " closed", Logger.logType.info);
+ if(Program.selectedParty == partyId) { Program.selectedParty = -1; }
+ Program.parties.Remove(partyId);
+ }
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Commands/Server/ServerCloseCommand.cs b/Galactic Colors Control Server/Commands/Server/ServerCloseCommand.cs
index f861576..0b5d95e 100644
--- a/Galactic Colors Control Server/Commands/Server/ServerCloseCommand.cs
+++ b/Galactic Colors Control Server/Commands/Server/ServerCloseCommand.cs
@@ -14,7 +14,7 @@ namespace Galactic_Colors_Control_Server.Commands
public bool IsClientSide { get { return false; } }
public bool IsNoConnect { get { return false; } }
public int minArgs { get { return 0; } }
- public int maxArgs { get { return 1; } }
+ public int maxArgs { get { return 0; } }
public void Execute(string[] args, Socket soc, bool server = false)
{
@@ -25,7 +25,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
- Utilities.ConsoleWrite("Server already close");
+ Utilities.ConsoleWrite("Server allready close");
}
}
}
diff --git a/Galactic Colors Control Server/Commands/Server/ServerOpenCommand.cs b/Galactic Colors Control Server/Commands/Server/ServerOpenCommand.cs
index fad8f5c..4d26763 100644
--- a/Galactic Colors Control Server/Commands/Server/ServerOpenCommand.cs
+++ b/Galactic Colors Control Server/Commands/Server/ServerOpenCommand.cs
@@ -14,7 +14,7 @@ namespace Galactic_Colors_Control_Server.Commands
public bool IsClientSide { get { return false; } }
public bool IsNoConnect { get { return false; } }
public int minArgs { get { return 0; } }
- public int maxArgs { get { return 1; } }
+ public int maxArgs { get { return 0; } }
public void Execute(string[] args, Socket soc, bool server = false)
{
@@ -25,7 +25,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
- Utilities.ConsoleWrite("Server already open");
+ Utilities.ConsoleWrite("Server allready open");
}
}
}
diff --git a/Galactic Colors Control Server/Commands/Server/ServerStopCommand.cs b/Galactic Colors Control Server/Commands/Server/ServerStopCommand.cs
new file mode 100644
index 0000000..73550b0
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/Server/ServerStopCommand.cs
@@ -0,0 +1,26 @@
+using Galactic_Colors_Control_Common;
+using System;
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class ServerStopCommand : ICommand
+ {
+ public string Name { get { return "stop"; } }
+ public string DescText { get { return "Stop the server."; } }
+ public string HelpText { get { return "Use /server stop to completly stop server."; } }
+ public Manager.CommandGroup Group { get { return Manager.CommandGroup.server; } }
+ 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; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ Program._run = false;
+ Utilities.ConsoleWrite("Stop server");
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Galactic Colors Control Server.csproj b/Galactic Colors Control Server/Galactic Colors Control Server.csproj
index d1fdaba..7243d67 100644
--- a/Galactic Colors Control Server/Galactic Colors Control Server.csproj
+++ b/Galactic Colors Control Server/Galactic Colors Control Server.csproj
@@ -59,6 +59,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -106,9 +117,7 @@
Galactic Colors Control Common
-
-
-
+