thanks for that :) the colors are just so people can see it easily really but i how its coded with the whole [ACCSERVER] etc stuff it makes it rather clear :)Quote:
Just took a quick look at the account server code looks good. I just have a suggestion since there is obviously going to be a lot of specialised output like green/red text I have this suggestion see the code box for new method and quick modification to the code.
Code:using System; using System.Threading; using LoginServer.Database; namespace LoginServer { class Program { public void Main(string[] args) { Console.Title = "Eudemons C# Login Server © Hio77"; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("--------------------------------------------"); Console.WriteLine("---Eudemons C# LoginServer - Starting up!---"); Console.WriteLine("--------------------------------------------"); Console.ResetColor(); Console.WriteLine(""); Console.WriteLine("Account Server Created by Hio77"); Console.WriteLine("This Account Server has been based off the COEMUv2 source"); Console.WriteLine("COEMUv2 was created by andyd123"); Console.WriteLine("The CoEMUv2 source can be found at: http://tinyurl.com/coemuv2"); Console.WriteLine(""); Console.WriteLine("This is made to work with the game server created by hio77 not any eo binary!"); Console.WriteLine(""); Console.WriteLine("[LoginServer] Starting MasterSocket Thread."); Connections.MasterSocket LoginSocket = new Connections.MasterSocket("LoginServer"); new Thread(LoginSocket.AcceptNewConnections).Start(); Console.WriteLine("[LoginServer] Init OK."); Console.WriteLine("[LoginServer] Connecting to Mysql."); if (Database.Database.TestConnect()) { WriteSpecialText("green","[Database] Connection OK.",true); } else { WriteSpecialText("Red","[Database] Connection FAIL.",false); LoginSocket.Close(); WriteSpecialText("Red", "[LoginServer-End-ERROR] Mastersocket closed, thread killed.",false); WriteSpecialText("Red", "[LoginServer-End-ERROR] Server Shutdown",true); } Console.WriteLine("[LoginServer] Searching for the Game Server...."); Console.WriteLine("[LoginServer] Press enter to kill the server."); Console.Read(); Console.WriteLine(""); LoginSocket.Close(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[LoginServer-End] Mastersocket closed, thread killed."); Console.WriteLine("[LoginServer-End] Server Shutdown"); } /// <summary> /// Writes a special message with low level formating /// </summary> /// <param name="colour">Colour the text is to be written in. (Red/Green)</param> /// <param name="text">Message to be written to console.</param> /// <param name="emptyline">True will allow for a proceding empty line after the message.</param> public void WriteSpecialText(string colour, string text, bool emptyline) { switch (colour.ToLower()) { case "green": Console.ForegroundColor=ConsoleColor.Green; break; case "red": Console.ForegroundColor = ConsoleColor.Red; break; default: Console.ResetColor(); break; } Console.WriteLine(text); if (emptyline) { Console.WriteLine(); } Console.ResetColor(); } } }
i never really thought of putting it into a method like that though lol