Rename Server
This commit is contained in:
parent
dbeb1d483a
commit
3928ce4f9b
|
@ -23,7 +23,7 @@ namespace Galactic_Colors_Control_Console
|
|||
/// <returns>Loaded config</returns>
|
||||
public Config Load()
|
||||
{
|
||||
Program.logger.Write("Loading config", Logger.logType.info);
|
||||
COnsole.logger.Write("Loading config", Logger.logType.info);
|
||||
Config config = new Config();
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Config.xml"))
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace Galactic_Colors_Control_Console
|
|||
}
|
||||
else
|
||||
{
|
||||
Program.logger.Write("Old config in Config.xml.old", Logger.logType.warm);
|
||||
COnsole.logger.Write("Old config in Config.xml.old", Logger.logType.warm);
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + "Config.xml.old");
|
||||
File.Move(AppDomain.CurrentDomain.BaseDirectory + "Config.xml", AppDomain.CurrentDomain.BaseDirectory + "Config.xml.old");
|
||||
config.Save();
|
||||
|
@ -45,11 +45,11 @@ namespace Galactic_Colors_Control_Console
|
|||
}
|
||||
else
|
||||
{
|
||||
Program.logger.Write("Any config file", Logger.logType.error);
|
||||
COnsole.logger.Write("Any config file", Logger.logType.error);
|
||||
config.Save();
|
||||
}
|
||||
if (Program._debug) { config.logLevel = Logger.logType.debug; }
|
||||
if (Program._dev) { config.logLevel = Logger.logType.dev; }
|
||||
if (COnsole._debug) { config.logLevel = Logger.logType.debug; }
|
||||
if (COnsole._dev) { config.logLevel = Logger.logType.dev; }
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -59,13 +59,13 @@ namespace Galactic_Colors_Control_Console
|
|||
public void Save()
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof(Config));
|
||||
if (Program._debug || Program._dev) { logLevel = Logger.logType.info; }
|
||||
if (COnsole._debug || COnsole._dev) { logLevel = Logger.logType.info; }
|
||||
using (StreamWriter st = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "Config.xml"))
|
||||
{
|
||||
xs.Serialize(st, this);
|
||||
};
|
||||
if (Program._debug) { logLevel = Logger.logType.debug; }
|
||||
if (Program._dev) { logLevel = Logger.logType.dev; }
|
||||
if (COnsole._debug) { logLevel = Logger.logType.debug; }
|
||||
if (COnsole._dev) { logLevel = Logger.logType.dev; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -86,7 +86,7 @@ namespace Galactic_Colors_Control_Console
|
|||
catch (XmlException e)
|
||||
{
|
||||
isCorrect = false;
|
||||
Program.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
COnsole.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,14 +100,14 @@ namespace Galactic_Colors_Control_Console
|
|||
|
||||
d.Validate((o, e) =>
|
||||
{
|
||||
Program.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
COnsole.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
isCorrect = false;
|
||||
});
|
||||
}
|
||||
catch (XmlException e)
|
||||
{
|
||||
isCorrect = false;
|
||||
Program.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
COnsole.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Galactic_Colors_Control_Console
|
|||
/// <summary>
|
||||
/// Console Client
|
||||
/// </summary>
|
||||
internal class Program
|
||||
internal class COnsole
|
||||
{
|
||||
public static bool _debug = false;
|
||||
public static bool _dev = false;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
public Party party
|
||||
{
|
||||
get { if (partyID != -1) { return Program.parties[partyID]; } else { return null; } }
|
||||
get { if (partyID != -1) { return Server.parties[partyID]; } else { return null; } }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(Program.clients.Count.ToString(), Program.config.size.ToString()));
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(Server.clients.Count.ToString(), Server.config.size.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,18 +20,18 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
Socket target = null;
|
||||
foreach (Socket client in Program.clients.Keys)
|
||||
foreach (Socket client in Server.clients.Keys)
|
||||
{
|
||||
if (Utilities.GetName(client) == args[2]) { target = client; }
|
||||
}
|
||||
if (target == null)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("CantFind"));
|
||||
|
||||
Program.logger.Write(args[2] + " was kick by server.", Logger.logType.info, Logger.logConsole.show);
|
||||
Server.logger.Write(args[2] + " was kick by server.", Logger.logType.info, Logger.logConsole.show);
|
||||
if (args.Length > 2)
|
||||
{
|
||||
Utilities.Send(target, new EventData(EventTypes.ServerKick, Common.Strings(args[3])));
|
||||
Program.logger.Write("because" + args[3], Logger.logType.debug);
|
||||
Server.logger.Write("because" + args[3], Logger.logType.debug);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (server)
|
||||
{
|
||||
string text = " ";
|
||||
foreach (Socket socket in Program.clients.Keys)
|
||||
foreach (Socket socket in Server.clients.Keys)
|
||||
{
|
||||
text += (Utilities.GetName(socket) + ", ");
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
}
|
||||
else
|
||||
{
|
||||
string[] data = new string[Program.clients.Count];
|
||||
string[] data = new string[Server.clients.Count];
|
||||
int i = 0;
|
||||
foreach (Socket socket in Program.clients.Keys)
|
||||
foreach (Socket socket in Server.clients.Keys)
|
||||
{
|
||||
data[i] = (Utilities.GetName(socket) + ", ");
|
||||
i++;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
Socket target = null;
|
||||
foreach (Socket client in Program.clients.Keys)
|
||||
foreach (Socket client in Server.clients.Keys)
|
||||
{
|
||||
if (Utilities.GetName(client) == args[2]) { target = client; }
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
string text = "";
|
||||
text += ("Name : " + Utilities.GetName(target) + Environment.NewLine);
|
||||
text += ("IP : " + ((IPEndPoint)target.LocalEndPoint).Address.ToString() + Environment.NewLine);
|
||||
if (Program.clients[target].party != null)
|
||||
if (Server.clients[target].party != null)
|
||||
{
|
||||
text += ("Party : " + Program.clients[target].party + Environment.NewLine);
|
||||
text += ("Party : " + Server.clients[target].party + Environment.NewLine);
|
||||
}
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(text));
|
||||
}
|
||||
|
|
|
@ -29,20 +29,20 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (args[1].Length < 3)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("TooShort"));
|
||||
|
||||
Program.logger.Write("Identifiaction request from " + Utilities.GetName(soc), Logger.logType.debug);
|
||||
Server.logger.Write("Identifiaction request from " + Utilities.GetName(soc), Logger.logType.debug);
|
||||
bool allreadyconnected = false;
|
||||
args[1] = args[1][0].ToString().ToUpper()[0] + args[1].Substring(1);
|
||||
foreach (Client client in Program.clients.Values)
|
||||
foreach (Client client in Server.clients.Values)
|
||||
{
|
||||
if (client.pseudo == args[1]) { allreadyconnected = true; break; }
|
||||
}
|
||||
if (allreadyconnected)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("AllreadyTaken"));
|
||||
|
||||
Program.clients[soc].status = 0;
|
||||
Program.clients[soc].pseudo = args[1];
|
||||
Server.clients[soc].status = 0;
|
||||
Server.clients[soc].pseudo = args[1];
|
||||
Utilities.Broadcast(new EventData(EventTypes.ServerJoin, Common.Strings(args[1])));
|
||||
Program.logger.Write("Identified as " + Utilities.GetName(soc) + " form " + ((IPEndPoint)soc.LocalEndPoint).Address.ToString(), Logger.logType.info);
|
||||
Server.logger.Write("Identified as " + Utilities.GetName(soc) + " form " + ((IPEndPoint)soc.LocalEndPoint).Address.ToString(), Logger.logType.info);
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(args[1]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
soc.Shutdown(SocketShutdown.Both);
|
||||
Program.logger.Write("Client disconnected from " + Utilities.GetName(soc), Logger.logType.info);
|
||||
Server.logger.Write("Client disconnected from " + Utilities.GetName(soc), Logger.logType.info);
|
||||
string username = Utilities.GetName(soc);
|
||||
bool connected = Program.clients[soc].status != -1;
|
||||
bool connected = Server.clients[soc].status != -1;
|
||||
soc.Close();
|
||||
Program.clients.Remove(soc);
|
||||
Server.clients.Remove(soc);
|
||||
if (connected) { Utilities.Broadcast(new EventData(EventTypes.ServerLeave, Common.Strings(username))); }
|
||||
Program.logger.Write("Size: " + Program.clients.Count + "/" + Program.config.size, Logger.logType.debug);
|
||||
Server.logger.Write("Size: " + Server.clients.Count + "/" + Server.config.size, Logger.logType.debug);
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
if (Enum.TryParse(args[1], true, out Program.config.logLevel))
|
||||
if (Enum.TryParse(args[1], true, out Server.config.logLevel))
|
||||
{
|
||||
Program.logger.ChangeLevel(Program.config.logLevel);
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(Program.config.logLevel.ToString()));
|
||||
Server.logger.ChangeLevel(Server.config.logLevel);
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(Server.config.logLevel.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
foreach (ICommand com in coms)
|
||||
{
|
||||
commands.Add(com);
|
||||
Program.logger.Write("Added command " + com.Group.ToString() + " " + com.Name, Logger.logType.debug);
|
||||
Server.logger.Write("Added command " + com.Group.ToString() + " " + com.Name, Logger.logType.debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Program.logger.Write("Command " + args[0] + " Exception : " + e.Message, Logger.logType.error);
|
||||
Server.logger.Write("Command " + args[0] + " Exception : " + e.Message, Logger.logType.error);
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("ExecuteException"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (!Utilities.AccessParty(ref partyId, args, false, soc, server))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
string[] data = new string[Program.parties[partyId].clients.Count];
|
||||
string[] data = new string[Server.parties[partyId].clients.Count];
|
||||
int i = 0;
|
||||
foreach (Socket client in Program.parties[partyId].clients)
|
||||
foreach (Socket client in Server.parties[partyId].clients)
|
||||
{
|
||||
data[i] = Utilities.GetName(client);
|
||||
i++;
|
||||
|
|
|
@ -23,10 +23,10 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (!Utilities.AccessParty(ref partyId, args, true, soc, server))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
if (!Program.parties[partyId].open)
|
||||
if (!Server.parties[partyId].open)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Allready"));
|
||||
|
||||
Program.parties[partyId].open = false;
|
||||
Server.parties[partyId].open = false;
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
if (!server && Program.clients[soc].partyID != -1)
|
||||
if (!server && Server.clients[soc].partyID != -1)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Allready"));
|
||||
|
||||
int size;
|
||||
|
@ -29,23 +29,23 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (size < 1)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("TooSmall"));
|
||||
|
||||
if (size > Program.config.size)
|
||||
if (size > Server.config.size)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("TooBig"));
|
||||
|
||||
if (Program.parties.Count >= Program.config.partysize)
|
||||
if (Server.parties.Count >= Server.config.partysize)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Full"));
|
||||
|
||||
Program.AddParty(new Party(args[2], size, Utilities.GetName(soc)));
|
||||
Program.logger.Write("Party " + args[2] + " create with " + size + " slots as " + Program.GetPartyID(false), Logger.logType.info);
|
||||
Server.AddParty(new Party(args[2], size, Utilities.GetName(soc)));
|
||||
Server.logger.Write("Party " + args[2] + " create with " + size + " slots as " + Server.GetPartyID(false), Logger.logType.info);
|
||||
if (server)
|
||||
{
|
||||
Program.selectedParty = Program.GetPartyID(false);
|
||||
Server.selectedParty = Server.GetPartyID(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.clients[soc].partyID = Program.GetPartyID(false);
|
||||
Server.clients[soc].partyID = Server.GetPartyID(false);
|
||||
}
|
||||
return new RequestResult(ResultTypes.OK, new string[3] { args[2], size.ToString(), (Program.GetPartyID(false)).ToString() });
|
||||
return new RequestResult(ResultTypes.OK, new string[3] { args[2], size.ToString(), (Server.GetPartyID(false)).ToString() });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,17 +20,17 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
if ((server && Program.selectedParty != -1) || (!server && Program.clients[soc].partyID != -1))
|
||||
if ((server && Server.selectedParty != -1) || (!server && Server.clients[soc].partyID != -1))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Allready"));
|
||||
|
||||
int id;
|
||||
if (!int.TryParse(args[2], out id))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Format"));
|
||||
|
||||
if (!Program.parties.ContainsKey(id))
|
||||
if (!Server.parties.ContainsKey(id))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("CantFind"));
|
||||
|
||||
Party party = Program.parties[id];
|
||||
Party party = Server.parties[id];
|
||||
if (args.Length == 3)
|
||||
{
|
||||
Array.Resize(ref args, 4);
|
||||
|
@ -41,7 +41,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
if (server)
|
||||
{
|
||||
Program.selectedParty = id;
|
||||
Server.selectedParty = id;
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
else
|
||||
|
@ -52,7 +52,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (party.clients.Count + 1 > party.size)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Full"));
|
||||
|
||||
Program.clients[soc].partyID = id;
|
||||
Server.clients[soc].partyID = id;
|
||||
Utilities.BroadcastParty(new EventData(EventTypes.PartyJoin, Common.Strings(Utilities.GetName(soc))), id);
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
Socket target = null;
|
||||
foreach (Socket client in Program.parties[partyId].clients)
|
||||
foreach (Socket client in Server.parties[partyId].clients)
|
||||
{
|
||||
if (Utilities.GetName(client) == args[2]) { target = client; }
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
{
|
||||
if (server)
|
||||
{
|
||||
Program.selectedParty = -1;
|
||||
Server.selectedParty = -1;
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
else
|
||||
|
@ -30,10 +30,10 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (!Utilities.AccessParty(ref partyId, args, false, soc, server))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
if (Program.parties[partyId].IsOwner(Utilities.GetName(soc)))
|
||||
if (Server.parties[partyId].IsOwner(Utilities.GetName(soc)))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Owner"));
|
||||
|
||||
Program.clients[soc].partyID = -1;
|
||||
Server.clients[soc].partyID = -1;
|
||||
Utilities.BroadcastParty(new EventData(EventTypes.PartyLeave, Common.Strings(Utilities.GetName(soc))), partyId);
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
|
|
|
@ -20,14 +20,14 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
if (Program.parties.Keys.Count == 0)
|
||||
if (Server.parties.Keys.Count == 0)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("AnyParty"));
|
||||
|
||||
string[] text = new string[Program.parties.Keys.Count];
|
||||
string[] text = new string[Server.parties.Keys.Count];
|
||||
int i = 0;
|
||||
foreach (int key in Program.parties.Keys)
|
||||
foreach (int key in Server.parties.Keys)
|
||||
{
|
||||
Party party = Program.parties[key];
|
||||
Party party = Server.parties[key];
|
||||
text[i] = (key + " : " + party.name + " : " + party.count + "/" + party.size + " : " + (party.open ? (party.isPrivate ? "private" : "open") : "close"));
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (!Utilities.AccessParty(ref partyId, args, true, soc, server))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
if (Program.parties[partyId].open)
|
||||
if (Server.parties[partyId].open)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Allready"));
|
||||
|
||||
Program.parties[partyId].open = true;
|
||||
Server.parties[partyId].open = true;
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
args[3] = "";
|
||||
}
|
||||
|
||||
if (!Program.parties[partyId].SetPassword(args[2], args[3]))
|
||||
if (!Server.parties[partyId].SetPassword(args[2], args[3]))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Password"));
|
||||
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (!Utilities.AccessParty(ref partyId, args, false, soc, server))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
Party party = Program.parties[partyId];
|
||||
Party party = Server.parties[partyId];
|
||||
if (server)
|
||||
{
|
||||
string text = "";
|
||||
|
|
|
@ -23,13 +23,13 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
if (!Utilities.AccessParty(ref partyId, args, true, soc, server))
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Access"));
|
||||
|
||||
foreach (Socket client in Program.parties[partyId].clients)
|
||||
foreach (Socket client in Server.parties[partyId].clients)
|
||||
{
|
||||
Manager.Execute(new string[4] { "party", "kick", Utilities.GetName(client), "stop_party" }, soc, server);
|
||||
}
|
||||
Program.logger.Write("Party " + Program.parties[partyId].name + " closed", Logger.logType.info, server ? Logger.logConsole.show : Logger.logConsole.normal);
|
||||
if (Program.selectedParty == partyId) { Program.selectedParty = -1; }
|
||||
Program.parties.Remove(partyId);
|
||||
Server.logger.Write("Party " + Server.parties[partyId].name + " closed", Logger.logType.info, server ? Logger.logConsole.show : Logger.logConsole.normal);
|
||||
if (Server.selectedParty == partyId) { Server.selectedParty = -1; }
|
||||
Server.parties.Remove(partyId);
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
if (!Program._open)
|
||||
if (!Server._open)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Allready"));
|
||||
|
||||
Program._open = false;
|
||||
Program.logger.Write("Server closed", Logger.logType.warm, Logger.logConsole.show);
|
||||
Server._open = false;
|
||||
Server.logger.Write("Server closed", Logger.logType.warm, Logger.logConsole.show);
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
if (Program._open)
|
||||
if (Server._open)
|
||||
return new RequestResult(ResultTypes.Error, Common.Strings("Allready"));
|
||||
|
||||
Program._open = true;
|
||||
Program.logger.Write("Server opened", Logger.logType.warm, Logger.logConsole.show);
|
||||
Server._open = true;
|
||||
Server.logger.Write("Server opened", Logger.logType.warm, Logger.logConsole.show);
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
string text = "";
|
||||
text += "Server : " + (Program._open ? "open" : "close");
|
||||
text += "Clients : " + Program.clients.Count + "/" + Program.config.size;
|
||||
text += "Parties : " + Program.parties.Count;
|
||||
text += "Server : " + (Server._open ? "open" : "close");
|
||||
text += "Clients : " + Server.clients.Count + "/" + Server.config.size;
|
||||
text += "Parties : " + Server.parties.Count;
|
||||
return new RequestResult(ResultTypes.OK, Common.Strings(text));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Galactic_Colors_Control_Server.Commands
|
|||
|
||||
public RequestResult Execute(string[] args, Socket soc, bool server = false)
|
||||
{
|
||||
Program._run = false;
|
||||
Server._run = false;
|
||||
return new RequestResult(ResultTypes.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ using System.Xml.Serialization;
|
|||
|
||||
namespace Galactic_Colors_Control_Server
|
||||
{
|
||||
//TODO Common config
|
||||
[XmlRoot("config")]
|
||||
public class Config
|
||||
{
|
||||
|
@ -26,7 +25,7 @@ namespace Galactic_Colors_Control_Server
|
|||
/// <returns>Loaded config</returns>
|
||||
public Config Load()
|
||||
{
|
||||
Program.logger.Write("Loading config", Logger.logType.info);
|
||||
Server.logger.Write("Loading config", Logger.logType.info);
|
||||
Config config = new Config();
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Config.xml"))
|
||||
{
|
||||
|
@ -40,7 +39,7 @@ namespace Galactic_Colors_Control_Server
|
|||
}
|
||||
else
|
||||
{
|
||||
Program.logger.Write("Old config in Config.xml.old", Logger.logType.warm);
|
||||
Server.logger.Write("Old config in Config.xml.old", Logger.logType.warm);
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + "Config.xml.old");
|
||||
File.Move(AppDomain.CurrentDomain.BaseDirectory + "Config.xml", AppDomain.CurrentDomain.BaseDirectory + "Config.xml.old");
|
||||
config.Save();
|
||||
|
@ -48,11 +47,11 @@ namespace Galactic_Colors_Control_Server
|
|||
}
|
||||
else
|
||||
{
|
||||
Program.logger.Write("Any config file", Logger.logType.error);
|
||||
Server.logger.Write("Any config file", Logger.logType.error);
|
||||
config.Save();
|
||||
}
|
||||
if (Program._debug) { config.logLevel = Logger.logType.debug; }
|
||||
if (Program._dev) { config.logLevel = Logger.logType.dev; }
|
||||
if (Server._debug) { config.logLevel = Logger.logType.debug; }
|
||||
if (Server._dev) { config.logLevel = Logger.logType.dev; }
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -62,13 +61,13 @@ namespace Galactic_Colors_Control_Server
|
|||
public void Save()
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof(Config));
|
||||
if (Program._debug || Program._dev) { logLevel = Logger.logType.info; }
|
||||
if (Server._debug || Server._dev) { logLevel = Logger.logType.info; }
|
||||
using (StreamWriter st = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "Config.xml"))
|
||||
{
|
||||
xs.Serialize(st, this);
|
||||
};
|
||||
if (Program._debug) { logLevel = Logger.logType.debug; }
|
||||
if (Program._dev) { logLevel = Logger.logType.dev; }
|
||||
if (Server._debug) { logLevel = Logger.logType.debug; }
|
||||
if (Server._dev) { logLevel = Logger.logType.dev; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -89,7 +88,7 @@ namespace Galactic_Colors_Control_Server
|
|||
catch (XmlException e)
|
||||
{
|
||||
isCorrect = false;
|
||||
Program.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
Server.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,14 +102,14 @@ namespace Galactic_Colors_Control_Server
|
|||
|
||||
d.Validate((o, e) =>
|
||||
{
|
||||
Program.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
Server.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
isCorrect = false;
|
||||
});
|
||||
}
|
||||
catch (XmlException e)
|
||||
{
|
||||
isCorrect = false;
|
||||
Program.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
Server.logger.Write("Error: " + e.Message, Logger.logType.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Project.dgml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
||||
|
|
|
@ -64,9 +64,9 @@ namespace Galactic_Colors_Control_Server
|
|||
get
|
||||
{
|
||||
List<Socket> list = new List<Socket>();
|
||||
foreach (Socket soc in Program.clients.Keys)
|
||||
foreach (Socket soc in Server.clients.Keys)
|
||||
{
|
||||
if (Program.clients[soc].party == this) { list.Add(soc); }
|
||||
if (Server.clients[soc].party == this) { list.Add(soc); }
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ using System.Threading;
|
|||
|
||||
namespace Galactic_Colors_Control_Server
|
||||
{
|
||||
internal class Program
|
||||
internal class Server
|
||||
{
|
||||
private const int BUFFER_SIZE = 2048;
|
||||
private static readonly Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DirectedGraph GraphDirection="RightToLeft" Layout="Sugiyama" ZoomLevel="-1" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
|
||||
<Nodes>
|
||||
<Node Id="(@1 @2 Type=Background)" Category="CodeSchema_Class" Bounds="538.8825,121.5,104.41,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Background" Icon="Microsoft.VisualStudio.Class.Public" Label="Background" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=9 StartCharacterOffset=17 EndLineNumber=9 EndCharacterOffset=27)" />
|
||||
<Node Id="(@1 @2 Type=Config)" Category="CodeSchema_Class" Bounds="679.2925,95.5,75.9799999999999,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Config" Icon="Microsoft.VisualStudio.Class.Public" Label="Config" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=9 StartCharacterOffset=17 EndLineNumber=9 EndCharacterOffset=23)" />
|
||||
<Node Id="(@1 @2 Type=Utilities)" Category="CodeSchema_Class" Bounds="532.8825,211.5,80.3733333333333,26" CodeSchemaProperty_IsInternal="True" CodeSchemaProperty_IsStatic="True" CommonLabel="Utilities" Icon="Microsoft.VisualStudio.Class.Internal" Label="Utilities" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=14 StartCharacterOffset=26 EndLineNumber=14 EndCharacterOffset=35)" />
|
||||
<Node Id="(@1 Namespace=Galactic_Colors_Control_GUI.States Type=State)" Category="CodeSchema_Class" Bounds="538.8825,149.5,67.5033333333333,26" CodeSchemaProperty_IsPublic="True" CommonLabel="State" Icon="Microsoft.VisualStudio.Class.Public" Label="State" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=7 StartCharacterOffset=17 EndLineNumber=7 EndCharacterOffset=22)" />
|
||||
<Node Id="(@5 @6 Type=Client)" Category="CodeSchema_Class" Bounds="117.463333333333,97.5,71.3766666666666,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Client" Icon="Microsoft.VisualStudio.Class.Public" Label="Client" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=2 StartCharacterOffset=17 EndLineNumber=2 EndCharacterOffset=23)" />
|
||||
<Node Id="(@5 @6 Type=Config)" Category="CodeSchema_Class" Bounds="20,153.5,75.98,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Config" Icon="Microsoft.VisualStudio.Class.Public" Label="Config" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=9 StartCharacterOffset=17 EndLineNumber=9 EndCharacterOffset=23)" />
|
||||
<Node Id="(@5 @6 Type=Party)" Category="CodeSchema_Class" Bounds="20,97.5,67.4633333333334,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Party" Icon="Microsoft.VisualStudio.Class.Public" Label="Party" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=6 StartCharacterOffset=17 EndLineNumber=6 EndCharacterOffset=22)" />
|
||||
<Node Id="(@5 @6 Type=Utilities)" Category="CodeSchema_Class" Bounds="125.98,153.5,80.3733333333334,26" CodeSchemaProperty_IsInternal="True" CommonLabel="Utilities" Icon="Microsoft.VisualStudio.Class.Internal" Label="Utilities" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=8 StartCharacterOffset=19 EndLineNumber=8 EndCharacterOffset=28)" />
|
||||
<Node Id="(@9 Namespace=Galactic_Colors_Control_Console Type=Config)" Category="CodeSchema_Class" Bounds="168.100595326591,263.274457405412,75.98,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Config" Icon="Microsoft.VisualStudio.Class.Public" Label="Config" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=9 StartCharacterOffset=17 EndLineNumber=9 EndCharacterOffset=23)" UseManualLocation="True" />
|
||||
<Node Id="@10" Category="CodeSchema_Class" Bounds="591.4525,0,105.25,25" CodeSchemaProperty_IsInternal="True" CommonLabel="COnsole" Group="Collapsed" Icon="Microsoft.VisualStudio.Class.Internal" Label="COnsole" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=12 StartCharacterOffset=19 EndLineNumber=12 EndCharacterOffset=26)" />
|
||||
<Node Id="@11" Category="CodeSchema_Class" Bounds="264.040833333333,125.5,94.6433333333333,26" CodeSchemaProperty_IsPublic="True" CommonLabel="EventData" Icon="Microsoft.VisualStudio.Class.Public" Label="EventData" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=16 StartCharacterOffset=17 EndLineNumber=16 EndCharacterOffset=26)" />
|
||||
<Node Id="@12" Category="CodeSchema_Class" Bounds="532.8825,95.5,116.41,86" CodeSchemaProperty_IsPublic="True" CommonLabel="Game" Group="Expanded" Icon="Microsoft.VisualStudio.Class.Public" Label="Game" LayoutSettings="List" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=17 StartCharacterOffset=17 EndLineNumber=17 EndCharacterOffset=21)" />
|
||||
<Node Id="@13" Category="CodeSchema_Interface" Bounds="20,209.5,99.29,26" CodeSchemaProperty_IsAbstract="True" CodeSchemaProperty_IsPublic="True" CommonLabel="ICommand" Icon="Microsoft.VisualStudio.Interface.Public" Label="ICommand" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=5 StartCharacterOffset=21 EndLineNumber=5 EndCharacterOffset=29)" />
|
||||
<Node Id="@15" Category="CodeSchema_Class" Bounds="264.040833333333,153.5,108.09,26" CodeSchemaProperty_IsPublic="True" CommonLabel="RequestData" Icon="Microsoft.VisualStudio.Class.Public" Label="RequestData" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=5 StartCharacterOffset=17 EndLineNumber=5 EndCharacterOffset=28)" />
|
||||
<Node Id="@16" Category="CodeSchema_Class" Bounds="264.040833333333,181.5,97.6533333333333,26" CodeSchemaProperty_IsPublic="True" CommonLabel="ResultData" Icon="Microsoft.VisualStudio.Class.Public" Label="ResultData" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=7 StartCharacterOffset=17 EndLineNumber=7 EndCharacterOffset=27)" />
|
||||
<Node Id="@17" Category="CodeSchema_Class" Bounds="0,57.5,226.353333333333,198" CodeSchemaProperty_IsInternal="True" CommonLabel="Server" Group="Expanded" Icon="Microsoft.VisualStudio.Class.Internal" Label="Server" LayoutSettings="TopToBottom" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=13 StartCharacterOffset=19 EndLineNumber=13 EndCharacterOffset=25)" />
|
||||
<Node Id="@4" Category="CodeSchema_Class" Bounds="409.818333333333,143.5,71.3766666666668,26" CodeSchemaProperty_IsPublic="True" CommonLabel="Client" Icon="Microsoft.VisualStudio.Class.Public" Label="Client" SourceLocation="(Assembly="file:///C:/Prog/Perso/C#/Galactic_Colors_Control/Galactic Colors Control GUI/Background.cs" StartLineNumber=15 StartCharacterOffset=17 EndLineNumber=15 EndCharacterOffset=23)" />
|
||||
<Node Id="GUI" Bounds="512.8825,55.5,262.39,202" Group="Expanded" Label="GUI" />
|
||||
<Node Id="Protocol" Bounds="258.040833333333,99.5,120.09,114" Group="Expanded" Label="Protocol" LayoutSettings="List" />
|
||||
</Nodes>
|
||||
<Links>
|
||||
<Link Source="@10" Target="(@9 Namespace=Galactic_Colors_Control_Console Type=Config)" Category="Contains" />
|
||||
<Link Source="@10" Target="@4" Bounds="456.59765625,24.0160751342773,136.876403808594,111.529426574707" />
|
||||
<Link Source="@11" Target="@4" Bounds="37.9653108693471,178.45197179752,14.0079243395009,135.04802820248" />
|
||||
<Link Source="@12" Target="(@1 @2 Type=Background)" Category="Contains" />
|
||||
<Link Source="@12" Target="(@1 Namespace=Galactic_Colors_Control_GUI.States Type=State)" Category="Contains" />
|
||||
<Link Source="@13" Target="@16" Bounds="87.1923359402041,178,351.798143996067,187.270943949832" />
|
||||
<Link Source="@15" Target="@13" Bounds="87.7165927232727,181.826888478205,339.877614934956,159.673111521795" />
|
||||
<Link Source="@16" Target="@4" Bounds="37.5486369719546,178.467902171197,16.1771494734605,191.032097828803" />
|
||||
<Link Source="@17" Target="(@5 @6 Type=Client)" Category="Contains" />
|
||||
<Link Source="@17" Target="(@5 @6 Type=Config)" Category="Contains" />
|
||||
<Link Source="@17" Target="(@5 @6 Type=Party)" Category="Contains" />
|
||||
<Link Source="@17" Target="(@5 @6 Type=Utilities)" Category="Contains" />
|
||||
<Link Source="@17" Target="@11" Bounds="87.2878546604131,155.760277476944,306.478812006254,153.705025272692" />
|
||||
<Link Source="@17" Target="@13" Category="Contains" />
|
||||
<Link Source="@4" Target="@15" Bounds="37.28750693196,169.5,20.0594811137036,163.06733221769" />
|
||||
<Link Source="GUI" Target="(@1 @2 Type=Config)" Category="Contains" />
|
||||
<Link Source="GUI" Target="(@1 @2 Type=Utilities)" Category="Contains" />
|
||||
<Link Source="GUI" Target="@12" Category="Contains" />
|
||||
<Link Source="GUI" Target="@4" Bounds="490.195007324219,156.5,22.6875,0" />
|
||||
<Link Source="Protocol" Target="@11" Category="Contains" />
|
||||
<Link Source="Protocol" Target="@15" Category="Contains" />
|
||||
<Link Source="Protocol" Target="@16" Category="Contains" />
|
||||
</Links>
|
||||
<Categories>
|
||||
<Category Id="CodeSchema_Class" Label="Classe" BasedOn="CodeSchema_Type" CanBeDataDriven="True" DefaultAction="Node:Both:CodeSchema_Member" Icon="CodeSchema_Class" NavigationActionLabel="Classes" />
|
||||
<Category Id="CodeSchema_Interface" Label="Interface" BasedOn="CodeSchema_Type" CanBeDataDriven="True" DefaultAction="Node:Both:CodeSchema_Member" Icon="CodeSchema_Interface" NavigationActionLabel="Interfaces" />
|
||||
<Category Id="CodeSchema_Type" Label="Type" CanBeDataDriven="True" DefaultAction="Node:Both:CodeSchema_Member" Icon="CodeSchema_Class" NavigationActionLabel="Types" />
|
||||
<Category Id="Contains" Label="Contient" Description="Si la source de la liaison contient ou non l'objet cible" CanBeDataDriven="False" CanLinkedNodesBeDataDriven="True" IncomingActionLabel="Contenu par" IsContainment="True" OutgoingActionLabel="Contient" />
|
||||
</Categories>
|
||||
<Properties>
|
||||
<Property Id="Bounds" DataType="System.Windows.Rect" />
|
||||
<Property Id="CanBeDataDriven" Label="CanBeDataDriven" Description="CanBeDataDriven" DataType="System.Boolean" />
|
||||
<Property Id="CanLinkedNodesBeDataDriven" Label="CanLinkedNodesBeDataDriven" Description="CanLinkedNodesBeDataDriven" DataType="System.Boolean" />
|
||||
<Property Id="CodeSchemaProperty_IsAbstract" Label="Est abstrait" Description="L'indicateur qui spécifie que le membre est 'Abstract' ne fournit pas une implémentation complète" DataType="System.Boolean" />
|
||||
<Property Id="CodeSchemaProperty_IsInternal" Label="Est interne" Description="Indicateur qui spécifie que la méthode est 'Internal'" DataType="System.Boolean" />
|
||||
<Property Id="CodeSchemaProperty_IsPublic" Label="Est public" Description="Indicateur qui spécifie que la portée est publique" DataType="System.Boolean" />
|
||||
<Property Id="CodeSchemaProperty_IsStatic" Label="Est statique" Description="Indicateur qui spécifie que le membre est un membre statique" DataType="System.Boolean" />
|
||||
<Property Id="CommonLabel" DataType="System.String" />
|
||||
<Property Id="DefaultAction" Label="DefaultAction" Description="DefaultAction" DataType="System.String" />
|
||||
<Property Id="GraphDirection" DataType="Microsoft.VisualStudio.Diagrams.Layout.LayoutOrientation" />
|
||||
<Property Id="Group" Label="Groupe" Description="Affiche le nœud en tant que groupe" DataType="Microsoft.VisualStudio.GraphModel.GraphGroupStyle" />
|
||||
<Property Id="Icon" Label="Icône" Description="Icône" DataType="System.String" />
|
||||
<Property Id="IncomingActionLabel" Label="IncomingActionLabel" Description="IncomingActionLabel" DataType="System.String" />
|
||||
<Property Id="IsContainment" DataType="System.Boolean" />
|
||||
<Property Id="Label" Label="Étiquette" Description="Étiquette affichable d'un objet pouvant être annoté" DataType="System.String" />
|
||||
<Property Id="Layout" DataType="System.String" />
|
||||
<Property Id="LayoutSettings" DataType="Microsoft.VisualStudio.Diagrams.View.GroupLayoutStyle" />
|
||||
<Property Id="NavigationActionLabel" Label="NavigationActionLabel" Description="NavigationActionLabel" DataType="System.String" />
|
||||
<Property Id="OutgoingActionLabel" Label="OutgoingActionLabel" Description="OutgoingActionLabel" DataType="System.String" />
|
||||
<Property Id="SourceLocation" Label="Numéro de la ligne de début" DataType="Microsoft.VisualStudio.GraphModel.CodeSchema.SourceLocation" />
|
||||
<Property Id="UseManualLocation" DataType="System.Boolean" />
|
||||
<Property Id="ZoomLevel" DataType="System.String" />
|
||||
</Properties>
|
||||
<QualifiedNames>
|
||||
<Name Id="Assembly" Label="Assembly" ValueType="Uri" />
|
||||
<Name Id="Namespace" Label="Espace de noms" ValueType="System.String" />
|
||||
<Name Id="Type" Label="Type" ValueType="System.Object" />
|
||||
</QualifiedNames>
|
||||
<IdentifierAliases>
|
||||
<Alias n="1" Uri="Assembly=file:///C:/Prog/Perso/C%2523/Galactic_Colors_Control/Galactic Colors Control GUI/bin/DesktopGL/x86/Release/Galactic Colors Control GUI.exe" />
|
||||
<Alias n="2" Id="Namespace=Galactic_Colors_Control_GUI" />
|
||||
<Alias n="3" Uri="Assembly=file:///C:/Prog/Perso/C%2523/Galactic_Colors_Control/Galactic Colors Control/bin/Release/Galactic Colors Control.dll" />
|
||||
<Alias n="4" Id="(@3 Namespace=Galactic_Colors_Control Type=Client)" />
|
||||
<Alias n="5" Uri="Assembly=file:///C:/Prog/Perso/C%2523/Galactic_Colors_Control/Galactic Colors Control Server/bin/Release/Galactic Colors Control Server.exe" />
|
||||
<Alias n="6" Id="Namespace=Galactic_Colors_Control_Server" />
|
||||
<Alias n="7" Uri="Assembly=file:///C:/Prog/Perso/C%2523/Galactic_Colors_Control/Galactic Colors Control Common/bin/Release/Galactic Colors Control Common.dll" />
|
||||
<Alias n="9" Uri="Assembly=file:///C:/Prog/Perso/C%2523/Galactic_Colors_Control/Galactic Colors Control Console/bin/Release/Galactic Colors Control Console.exe" />
|
||||
<Alias n="10" Id="(@9 Namespace=Galactic_Colors_Control_Console Type=COnsole)" />
|
||||
<Alias n="11" Id="(@7 Namespace=Galactic_Colors_Control_Common.Protocol Type=EventData)" />
|
||||
<Alias n="12" Id="(@1 @2 Type=Game)" />
|
||||
<Alias n="13" Id="(@5 Namespace=Galactic_Colors_Control_Server.Commands Type=ICommand)" />
|
||||
<Alias n="15" Id="(@7 Namespace=Galactic_Colors_Control_Common.Protocol Type=RequestData)" />
|
||||
<Alias n="16" Id="(@7 Namespace=Galactic_Colors_Control_Common.Protocol Type=ResultData)" />
|
||||
<Alias n="17" Id="(@5 @6 Type=Server)" />
|
||||
</IdentifierAliases>
|
||||
</DirectedGraph>
|
|
@ -17,10 +17,10 @@ namespace Galactic_Colors_Control_Server
|
|||
if (soc == null)
|
||||
return true;
|
||||
|
||||
if (Program.clients.ContainsKey(soc))
|
||||
return Program.clients[soc].status != -1;
|
||||
if (Server.clients.ContainsKey(soc))
|
||||
return Server.clients[soc].status != -1;
|
||||
|
||||
Program.logger.Write("IsConnect : Unknown client", Logger.logType.error);
|
||||
Server.logger.Write("IsConnect : Unknown client", Logger.logType.error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,12 @@ namespace Galactic_Colors_Control_Server
|
|||
public static string GetName(Socket soc)
|
||||
{
|
||||
if (soc == null)
|
||||
return Program.multilang.Get("Server",Program.config.lang);
|
||||
return Server.multilang.Get("Server", Server.config.lang);
|
||||
|
||||
if (!Program.clients.ContainsKey(soc))
|
||||
if (!Server.clients.ContainsKey(soc))
|
||||
return "?";
|
||||
|
||||
string res = Program.clients[soc].pseudo;
|
||||
string res = Server.clients[soc].pseudo;
|
||||
if (res == "") { res = ((IPEndPoint)soc.LocalEndPoint).Address.ToString(); }
|
||||
return res;
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ namespace Galactic_Colors_Control_Server
|
|||
public static int GetParty(Socket soc)
|
||||
{
|
||||
if (soc == null)
|
||||
return Program.selectedParty;
|
||||
return Server.selectedParty;
|
||||
|
||||
return Program.clients[soc].partyID;
|
||||
return Server.clients[soc].partyID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,14 +62,14 @@ namespace Galactic_Colors_Control_Server
|
|||
try
|
||||
{
|
||||
soc.Send(packet.ToBytes());
|
||||
if (Program.config.logLevel == Logger.logType.dev)
|
||||
if (Server.config.logLevel == Logger.logType.dev)
|
||||
{
|
||||
Program.logger.Write("Send to " + GetName(soc) + " : " + packet.ToLongString(), Logger.logType.dev);
|
||||
Server.logger.Write("Send to " + GetName(soc) + " : " + packet.ToLongString(), Logger.logType.dev);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Program.logger.Write("Send exception to " + GetName(soc) + " : " + e.Message, Logger.logType.error);
|
||||
Server.logger.Write("Send exception to " + GetName(soc) + " : " + e.Message, Logger.logType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,14 +82,14 @@ namespace Galactic_Colors_Control_Server
|
|||
/// <param name="message">Message to display for server</param>
|
||||
public static void Broadcast(Data packet)
|
||||
{
|
||||
foreach (Socket soc in Program.clients.Keys)
|
||||
foreach (Socket soc in Server.clients.Keys)
|
||||
{
|
||||
Send(soc, packet);
|
||||
}
|
||||
switch (packet.GetType().Name)
|
||||
{
|
||||
case "EventData":
|
||||
Common.ConsoleWrite(Program.multilang.GetEventText((EventData)packet, Program.config.lang));
|
||||
Common.ConsoleWrite(Server.multilang.GetEventText((EventData)packet, Server.config.lang));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -107,19 +107,19 @@ namespace Galactic_Colors_Control_Server
|
|||
/// <param name="message">Message to display for server</param>
|
||||
public static void BroadcastParty(Data data, int party)
|
||||
{
|
||||
foreach (Socket soc in Program.clients.Keys)
|
||||
foreach (Socket soc in Server.clients.Keys)
|
||||
{
|
||||
if (Program.clients[soc].partyID == party)
|
||||
if (Server.clients[soc].partyID == party)
|
||||
{
|
||||
Send(soc, data);
|
||||
}
|
||||
}
|
||||
if (Program.selectedParty == party)
|
||||
if (Server.selectedParty == party)
|
||||
{
|
||||
switch (data.GetType().Name)
|
||||
{
|
||||
case "EventData":
|
||||
Common.ConsoleWrite(Program.multilang.GetEventText((EventData)data, Program.config.lang));
|
||||
Common.ConsoleWrite(Server.multilang.GetEventText((EventData)data, Server.config.lang));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -160,31 +160,31 @@ namespace Galactic_Colors_Control_Server
|
|||
{
|
||||
if (server)
|
||||
{
|
||||
if (Program.selectedParty == -1)
|
||||
if (Server.selectedParty == -1)
|
||||
return false;
|
||||
|
||||
if (Program.parties.ContainsKey(Program.selectedParty))
|
||||
if (Server.parties.ContainsKey(Server.selectedParty))
|
||||
{
|
||||
partyId = Program.selectedParty;
|
||||
partyId = Server.selectedParty;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.selectedParty = -1;
|
||||
Server.selectedParty = -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Program.clients[soc].partyID == -1)
|
||||
if (Server.clients[soc].partyID == -1)
|
||||
return false;
|
||||
|
||||
if (!Program.parties.ContainsKey(Program.clients[soc].partyID))
|
||||
if (!Server.parties.ContainsKey(Server.clients[soc].partyID))
|
||||
return false;
|
||||
|
||||
if (Program.parties[Program.clients[soc].partyID].IsOwner(GetName(soc)) || !needOwn)
|
||||
if (Server.parties[Server.clients[soc].partyID].IsOwner(GetName(soc)) || !needOwn)
|
||||
{
|
||||
partyId = Program.clients[soc].partyID;
|
||||
partyId = Server.clients[soc].partyID;
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
|
|
|
@ -32,6 +32,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
ProjectSection(SolutionItems) = preProject
|
||||
Changelog.md = Changelog.md
|
||||
License.md = License.md
|
||||
Galactic Colors Control Server\Project.dgml = Galactic Colors Control Server\Project.dgml
|
||||
Readme.md = Readme.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
Reference in New Issue