Index: src/config/config.cs =================================================================== --- src/config/config.cs (revision 36) +++ src/config/config.cs (working copy) @@ -17,41 +17,58 @@ */ namespace Drive_LFSS.Config_ { + using Drive_LFSS.Game_; using System.Collections.Generic; + using System.Net; using System.IO; using System; + using Drive_LFSS.Definition_; public static class Config { public struct ServerConfigStruct { - public ServerConfigStruct(string _serverIP, ushort _portNumber, string _adminPass, char _commandPrefix, byte _inSimOptionMask, ushort _netUpdateInterval, ushort _serverUpdateInterval) + public ServerConfigStruct(string _serverName, string _serverIP, ushort _tcpPort, ushort _udpPort, string _adminPass, char _commandPrefix, ushort _inSimOptionMask, ushort _netUpdateInterval, ushort _serverUpdateInterval) { - serverIP = _serverIP; - portNumber = _portNumber; + session = new Session(_serverName); + serverIP = IPAddress.Parse(_serverIP); + tcpPort = _tcpPort; + udpPort = _udpPort; adminPass = _adminPass; commandPrefix = _commandPrefix; inSimOptionMask = _inSimOptionMask; netUpdateInterval = _netUpdateInterval; serverUpdateInterval = _serverUpdateInterval; + inSimFlags = InSim_Flag.INSIM_FLAG_KEEP_MESSAGE_COLOR | InSim_Flag.INSIM_FLAG_RECEIVE_MCI; + connectionName = ""; } - private string serverIP; - private ushort portNumber; + public Session session; + private ushort udpPort; + private IPAddress serverIP; + private ushort tcpPort; private string adminPass; private char commandPrefix; - private byte inSimOptionMask; + private ushort inSimOptionMask; private ushort netUpdateInterval; private ushort serverUpdateInterval; - public string ServerIP + private string connectionName; + private InSim_Flag inSimFlags; + + public IPAddress ServerIP { get { return serverIP; } //set { serverIP = value; } } - public ushort PortNumber + public ushort TcpPort { - get { return portNumber; } + get { return tcpPort; } //set { portNumber = value; } } + public ushort UdpPort + { + get { return udpPort; } + //set { portNumber = value; } + } public string AdminPass { get { return adminPass; } @@ -62,7 +79,7 @@ get { return commandPrefix; } //set { commandPrefix = value; } } - public byte InSimOptionMask + public ushort InSimOptionMask { get { return inSimOptionMask; } //set { InSimOptionMask = value; } @@ -77,6 +94,16 @@ get { return serverUpdateInterval; } //set { serverUpdateInterval = value; } } + public string ConnectionName + { + get { return connectionName; } + //set { connectionName = value; } + } + public InSim_Flag InSimFlags + { + get { return inSimFlags; } + //set { inSimFlags = value; } + } } private const string CONFIG_FILE = "dlfss.cfg"; @@ -87,7 +114,7 @@ private static uint DLFSSSUpdateRate = 0; private static int logDisable = 0; //mask variable - private static Dictionary serverList = new Dictionary(); + public static Dictionary serverList = new Dictionary(); public static bool Initialize() { @@ -210,24 +237,32 @@ private static bool CreateServer(string _line, ushort _lineNumber, string _serverName) { string tempoConf = _line.Substring(_line.IndexOf('=') + 1, _line.Length - (_line.IndexOf('=') + 1)).Trim(' '); - string[] args = tempoConf.Split(new string[] { ";" }, 7, StringSplitOptions.RemoveEmptyEntries); + string[] args = tempoConf.Split(new string[] { ";" }, 8, StringSplitOptions.RemoveEmptyEntries); - if (args.Length != 7) + if (args.Length != 8) { Program.log.error("Error in config file at line: " + _lineNumber + ", incorrect parameter count: " + tempoConf + ".\r\n"); return false; } - try + if (!serverList.ContainsKey(_serverName)) { - serverList.Add(_serverName, new ServerConfigStruct(args[0], Convert.ToUInt16(args[1]), args[2], Convert.ToChar(args[3]), Convert.ToByte(args[4]), Convert.ToUInt16(args[5]), Convert.ToUInt16(args[6]))); - //Program.log.normal("CreateServer name : " + _serverName + ", value : " + tempoConf + "\r\n"); //FOR DEBUG IF U NEED + try + { + serverList.Add(_serverName, new ServerConfigStruct(_serverName, args[0], Convert.ToUInt16(args[1]), Convert.ToUInt16(args[2]), args[3], Convert.ToChar(args[4]), Convert.ToUInt16(args[5]), Convert.ToUInt16(args[6]), Convert.ToUInt16(args[7]))); + //Program.log.normal("CreateServer name : " + _serverName + ", value : " + tempoConf + "\r\n"); //FOR DEBUG IF U NEED + } + catch (Exception _exception) + { + Program.log.error("Error in config file at line: " + _lineNumber + ", incorrect parameter: " + tempoConf + "\r\n"); + return false; + } } - catch (Exception _exception) + else { - Program.log.error("Error in config file at line: " + _lineNumber + ", incorrect parameter: " + tempoConf + "\r\n"); - return false; + Program.log.error("Duplicate server in config file at line: " + _lineNumber + ", incorrect parameter: " + tempoConf + ", Line ignored.\r\n"); } + return true; } private static bool ValidConfVersion(string _line) Index: src/dlfss.cfg =================================================================== --- src/dlfss.cfg (revision 36) +++ src/dlfss.cfg (working copy) @@ -72,5 +72,5 @@ # ###################################### -LFSServer.AleajectaS2.ConnectionInfo = 67.212.66.26;30001;dexxa;$;40;100;100 -LFSServer.AleajectaS1.ConnectionInfo = 67.212.66.26;29999;dexxa;$;40;100;100 +LFSServer.AleajectaS2.ConnectionInfo = 67.212.66.26;30001;10006;dexxa;$;40;100;100 +LFSServer.AleajectaS1.ConnectionInfo = 67.212.66.26;29999;10006;dexxa;$;40;100;100 Index: src/drive_lfss/command_console/command.cs =================================================================== --- src/drive_lfss/command_console/command.cs (revision 36) +++ src/drive_lfss/command_console/command.cs (working copy) @@ -23,6 +23,7 @@ using Drive_LFSS.Packet_; using Drive_LFSS.Game_; using Drive_LFSS.Definition_; + using Drive_LFSS.Config_; //using System.Collections.Generic; //using System.Text; @@ -48,73 +49,61 @@ { if (args.Length != 2) { - Program.log.normal("Command Status, Syntax Error.\r\n Usage:\r\n status #serverId\r\n"); + Program.log.normal("Command Status, Syntax Error.\r\n Usage:\r\n status #serverName\r\n"); return; } if (args[1] == "*") { //Maybe you Real Iterator - foreach (KeyValuePair keyPair in SessionList.sessionList) + foreach (KeyValuePair keyPair in Config.serverList) { - Session session = SessionList.sessionList[keyPair.Key].session; + Session session = Config.serverList[keyPair.Key].session; if(session.IsSocketStatus(InSim_Socket_State.INSIM_SOCKET_CONNECTED)) - Program.log.normal("ServerId: " + keyPair.Key + ", Status: online, ReactionTime: " + session.GetReactionTime() + "ms" + ", DriversCount: " + session.GetNbrOfDrivers() + "\r\n"); + Program.log.normal("serverName: " + keyPair.Key + ", Status: online, ReactionTime: " + session.GetReactionTime() + "ms" + ", DriversCount: " + session.GetNbrOfDrivers() + "\r\n"); else - Program.log.error("ServerId: " + keyPair.Key + ", Status: offline, ReactionTime+/-: -ms, DriversCount: -\r\n"); + Program.log.error("serverName: " + keyPair.Key + ", Status: offline, ReactionTime+/-: -ms, DriversCount: -\r\n"); } } else { - ushort serverId; - try { serverId = Convert.ToUInt16(args[1]); } - catch (Exception _exception) - { - Program.log.normal("Command Status, Syntax Error.\r\n Usage:\r\n status #serverId\r\n"); - return; - } + string serverName = args[0]; - if (SessionList.sessionList.ContainsKey(serverId)) + if (Config.serverList.ContainsKey(serverName)) { - Session session = SessionList.sessionList[serverId].session; + Session session = Config.serverList[serverName].session; if (session.IsSocketStatus(InSim_Socket_State.INSIM_SOCKET_CONNECTED)) - Program.log.normal("ServerId: " + serverId + ", Status: online, Latency: " + session.GetLatency() + "ms" + ", DriversCount: " + session.GetNbrOfDrivers() + "\r\n"); + Program.log.normal("serverName: " + serverName + ", Status: online, Latency: " + session.GetLatency() + "ms" + ", DriversCount: " + session.GetNbrOfDrivers() + "\r\n"); else - Program.log.error("ServerId: " + serverId + ", Status: offline, Latency: -ms, DriversCount: -\r\n"); + Program.log.error("serverName: " + serverName + ", Status: offline, Latency: -ms, DriversCount: -\r\n"); } else - Program.log.command("Command Status, ServerId Not Found, Server Requested was: " + serverId + "\r\n"); + Program.log.command("Command Status, serverName Not Found, Server Requested was: " + serverName + "\r\n"); } } private static void Say(string[] args) { if (args.Length != 2) { - Program.log.normal("Command Say, Syntax Error.\r\n Usage:\r\n say #serverId $Message\r\n"); + Program.log.normal("Command Say, Syntax Error.\r\n Usage:\r\n say #serverName $Message\r\n"); return; } if (args[0] == "*") { - foreach (KeyValuePair keyPair in SessionList.sessionList) - SessionList.sessionList[keyPair.Key].session.AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_MST, Packet_Type.PACKET_MST_SEND_NORMAL_CHAT, new PacketMST(args[1]))); + foreach (KeyValuePair keyPair in Config.serverList) + Config.serverList[keyPair.Key].session.AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_MST, Packet_Type.PACKET_MST_SEND_NORMAL_CHAT, new PacketMST(args[1]))); } else { - ushort serverId; - try { serverId = Convert.ToUInt16(args[0]); } - catch (Exception _exception) - { - Program.log.normal("Command Announce, Syntax Error.\r\n Usage:\r\n announce #serverId $Message\r\n"); - return; - } + string serverName = args[0]; - if (SessionList.sessionList.ContainsKey(serverId)) - SessionList.sessionList[serverId].session.AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_MST, Packet_Type.PACKET_MST_SEND_NORMAL_CHAT, new PacketMST(args[1]))); + if (Config.serverList.ContainsKey(serverName)) + Config.serverList[serverName].session.AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_MST, Packet_Type.PACKET_MST_SEND_NORMAL_CHAT, new PacketMST(args[1]))); else - Program.log.command("Command Announce, ServerId Not Found, Server Requested was: " + args[0] + "\r\n"); + Program.log.command("Command Announce, serverName Not Found, Server Requested was: " + args[0] + "\r\n"); } } private static void Exit() Index: src/drive_lfss/drive_lfss.cs =================================================================== --- src/drive_lfss/drive_lfss.cs (revision 36) +++ src/drive_lfss/drive_lfss.cs (working copy) @@ -101,10 +101,6 @@ //Database Initialization log.normal("Initializating Database...\r\n\r\n"); DatabaseStorage.Initialize(); - - //Create Object for All Configured Server - log.normal("Initializating Servers Config...\r\n\r\n"); - SessionList.LoadServerConfig( ); //Session.InitializeServerList(); Index: src/drive_lfss/session_list.cs =================================================================== --- src/drive_lfss/session_list.cs (revision 36) +++ src/drive_lfss/session_list.cs (working copy) @@ -24,39 +24,15 @@ using Drive_LFSS.InSim_; using Drive_LFSS.Server_; using Drive_LFSS.Game_; + using Drive_LFSS.Config_; //using Drive_LFSS.Database_; public static class SessionList //Must become compatible with all Session type: ServerInSim, ClientOutGauge, ... Im not aware of all.... { - public struct SessionStruct - {//(/*Racing_Flag.InSim_Flag.ISF_MSO_COLS |*/ InSim_Flag.ISF_MCI), '$', 10000, "dexxa", "Aleajecta S2", 5))) - public SessionStruct(ushort _sessionId, InSimSetting _inSimSetting) - { - sessionId = _sessionId; - inSimSetting = _inSimSetting; - session = new Session(sessionId, inSimSetting); - } - public ushort sessionId; - public InSimSetting inSimSetting; - public Session session; - } - - //ServerId To "Server" - public static Dictionary sessionList = new Dictionary(); - - public static void LoadServerConfig( ) - { - // sessionList.Add(5, new SessionStruct(5, new InSimSetting("91.121.7.73", 20003, 20003, InSim_Flag.INSIM_FLAG_KEEP_MESSAGE_COLOR | InSim_Flag.INSIM_FLAG_RECEIVE_MCI, '$', 10, "yourpass", "DriveLFSS", 5))); - // sessionList.Add(1, new SessionStruct(1, new InSimSetting("67.212.66.26", 30001, 30001, InSim_Flag.INSIM_FLAG_KEEP_MESSAGE_COLOR | InSim_Flag.INSIM_FLAG_RECEIVE_MCI, '$', 10, "dexxa", "DriveLFSS", 5))); - sessionList.Add(2, new SessionStruct(2, new InSimSetting("67.212.66.26", 29999, 29999, InSim_Flag.INSIM_FLAG_KEEP_MESSAGE_COLOR | InSim_Flag.INSIM_FLAG_RECEIVE_MCI, '$', 100, "dexxa", "DriveLFSS", 5))); - // sessionList.Add(3, new SessionStruct(3, new InSimSetting("67.212.66.26", 29989, 29989, InSim_Flag.INSIM_FLAG_KEEP_MESSAGE_COLOR | InSim_Flag.INSIM_FLAG_RECEIVE_MCI, '$', 10, "dexxa", "DriveLFSS", 5))); - // sessionList.Add(4, new SessionStruct(4, new InSimSetting("67.212.66.26", 30000, 30000, InSim_Flag.INSIM_FLAG_KEEP_MESSAGE_COLOR | InSim_Flag.INSIM_FLAG_RECEIVE_MCI, '$', 10, "dexxa", "DriveLFSS", 5))); - } - public static void update(uint diff) { - foreach (KeyValuePair keyPair in sessionList) + foreach (KeyValuePair keyPair in Config.serverList) { if (keyPair.Value.session.connectionRequest) { @@ -73,14 +49,14 @@ keyPair.Value.session.update(diff); } } - public static void ConnectToServerId(ushort serverId) + public static void ConnectToServerId(string serverName) { - Thread ThreadConnectionProcess = new Thread(new ThreadStart(sessionList[serverId].session.connect)); + Thread ThreadConnectionProcess = new Thread(new ThreadStart(Config.serverList[serverName].session.connect)); ThreadConnectionProcess.Start(); } public static void exit() { - foreach (KeyValuePair keyPair in sessionList) + foreach (KeyValuePair keyPair in Config.serverList) { keyPair.Value.session.exit(); } Index: src/game/race.cs =================================================================== --- src/game/race.cs (revision 36) +++ src/game/race.cs (working copy) @@ -22,15 +22,16 @@ using Drive_LFSS.Definition_; using Drive_LFSS.Database_; using Drive_LFSS.Script_; + using Drive_LFSS.Config_; public sealed class Race : IRace { - public Race(ushort _serverId) + public Race(string _serverName) { - serverId = _serverId; + serverName = _serverName; gridOrder = ""; } - private ushort serverId; + private string serverName; private bool isRacing; private uint timeStart; private static uint guid; //Have to be initialized at Start, and we increment at each RaceEnd(Saving) @@ -94,7 +95,7 @@ { if (raceInProgress == Race_In_Progress_Status.RACE_PROGRESS_NONE) { - SessionList.sessionList[serverId].session.log.error("System Think Race is Starded, But LFS Server Say:" + raceInProgress + "\r\n"); + Config.serverList[serverName].session.log.error("System Think Race is Starded, But LFS Server Say:" + raceInProgress + "\r\n"); isRacing = false; } } Index: src/game/session.cs =================================================================== --- src/game/session.cs (revision 36) +++ src/game/session.cs (working copy) @@ -26,15 +26,16 @@ using Drive_LFSS.Packet_; using Drive_LFSS.Definition_; using Drive_LFSS.Script_; + using Drive_LFSS.Config_; public sealed class Session : Server, ISession { - public Session(ushort _serverId, InSimSetting _inSimSetting) : base(_serverId, _inSimSetting) + public Session(string _serverName) : base(_serverName) { - commandPrefix = _inSimSetting.CommandPrefix; + commandPrefix = Config.serverList[_serverName].CommandPrefix; - race = new Race(_serverId); + race = new Race(_serverName); driverList = new List(); driverList.Add(new Driver(this)); //put Default Driver 0, will save some If. driverList.Capacity = 192; Index: src/log/log.cs =================================================================== --- src/log/log.cs (revision 36) +++ src/log/log.cs (working copy) @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Threading; using Drive_LFSS; +using Drive_LFSS.Config_; namespace Drive_LFSS.Log_ { @@ -40,13 +41,13 @@ //If Color Not Allways Working Good, Cause log is Used by MultiThread! and Console Color Seem to be... MS way :) sealed public class sLog { - public sLog(ushort _serverId) + public sLog(string _serverName) { if (!isInitialized) { throw new Exception("You can't Create Log Without Initializing, Please call: sLog.Init() First!"); } - serverId = _serverId; + serverName = _serverName; } public sLog() { @@ -54,7 +55,7 @@ { throw new Exception("You can't Create Log Without Initializing, Please call: sLog.Init() First!"); } - serverId = 0; + serverName = ""; } #if DEBUG public Log_Type logDisable = Log_Type.LOG_NETWORK; @@ -62,9 +63,8 @@ public Log_Type logDisable = Log_Type.LOG_DISABLE; #endif - public ushort serverId = 0; + public string serverName = ""; - private static Mutex mutexConsoleColor = new Mutex(); private const string LOG_FILE_PATH = @".\drive_lfss.log"; private static System.IO.StreamWriter streamWriter; @@ -229,13 +229,10 @@ } private string GetServerName() { - if (serverId == 0) - return ""; - //Create Function into Server Go that That Info - if (SessionList.sessionList.ContainsKey(serverId)) - return "Server["+serverId+/*Session.server[serverId].settings.connectionName+*/"] -> "; - + if (Config.serverList.ContainsKey(serverName)) + return "Server[" + serverName +/*Config.serverList[serverName].connectionName+*/"] -> "; + return "Unknow -> "; } } Index: src/network/insim/insim.cs =================================================================== --- src/network/insim/insim.cs (revision 36) +++ src/network/insim/insim.cs (working copy) @@ -25,6 +25,7 @@ //using System.Runtime.CompilerServices; using System.Threading; //using Drive_LFSS.PacketStore_; + using Drive_LFSS.Config_; using Drive_LFSS.Definition_; using Drive_LFSS.Packet_; using Drive_LFSS.Server_; @@ -32,22 +33,23 @@ public abstract class InSim : PacketHandler { - public InSim(InSimSetting _inSimSetting) + public InSim(string _serverName) { + serverName = _serverName; string errorMessage = ""; - if (_inSimSetting.adminPassword.Length > 0x10) + if (Config.serverList[serverName].AdminPass.Length > 0x10) { errorMessage += "Administrator Password must be 16 characters long maximun.\r\n"; } - if (_inSimSetting.connectionName.Length > 0x10) + if (Config.serverList[serverName].ConnectionName.Length > 0x10) { - errorMessage += "Connection Name must be 16 characters long maximun.\r\n"; + errorMessage += "Connection Name must be 16 characters long maximum.\r\n"; } - if (_inSimSetting.tcpPort < 1024) + if (Config.serverList[serverName].TcpPort < 1024) { errorMessage += "TCP Port number must be > 1024.\r\n"; } - if (_inSimSetting.udpPort != 0 && _inSimSetting.udpPort < 1024) + if (Config.serverList[serverName].UdpPort != 0 && Config.serverList[serverName].UdpPort < 1024) { errorMessage += "UDP Port number must be > 1024.\r\n"; } @@ -56,7 +58,6 @@ //TODO //throw new InvalidConfigurationException(errorMessage + "\r\nVerify you InSimSettings parameters for incorrect values."); } - inSimSetting = _inSimSetting; threadSocketReceive = new Thread(new ThreadStart(SocketReceive)); //packetStore = new Store(); } @@ -66,8 +67,8 @@ { get { return ((Server)this).serverId; } }*/ + private string serverName; private InSim_Socket_State socketStatus = InSim_Socket_State.INSIM_SOCKET_DISCONNECTED; - private InSimSetting inSimSetting; private bool runThreadSocketReceive = false; private Thread threadSocketReceive; private TcpClient tcpClient; @@ -84,7 +85,7 @@ if (udpClient != null) { byte[] dgram = new byte[1]; - udpClient.Send(dgram, 1, "localhost", inSimSetting.udpPort); + udpClient.Send(dgram, 1, "localhost", Config.serverList[serverName].UdpPort); } socketStatus = InSim_Socket_State.INSIM_SOCKET_DISCONNECTED; @@ -101,19 +102,19 @@ socketStatus = InSim_Socket_State.INSIM_SOCKET_DISCONNECTED; tcpClient = new TcpClient(); - try{ tcpClient.Connect(new IPEndPoint(inSimSetting.serverIp, inSimSetting.tcpPort)); } + try{ tcpClient.Connect(new IPEndPoint(Config.serverList[serverName].ServerIP, Config.serverList[serverName].TcpPort)); } catch (SocketException _exception) { return;//throw new Exception("TCP Socket Initialization failded, Error was: " +_exception.Message); } tcpSocket = tcpClient.GetStream(); - - PacketISI packetISI = new PacketISI(1, inSimSetting.udpPort, (ushort)inSimSetting.Flags, inSimSetting.CommandPrefix, inSimSetting.MCI_NLP_Interval, inSimSetting.adminPassword, inSimSetting.connectionName); + + PacketISI packetISI = new PacketISI(1, Config.serverList[serverName].UdpPort, (ushort)Config.serverList[serverName].InSimFlags, Config.serverList[serverName].CommandPrefix, Config.serverList[serverName].NetUpdateInterval, Config.serverList[serverName].AdminPass, Config.serverList[serverName].ConnectionName); AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_ISI, Packet_Type.PACKET_ISI_INSIM_INITIALISE, packetISI)); System.Threading.Thread.Sleep(1000); - udpIpEndPoint = new IPEndPoint(IPAddress.Any, inSimSetting.udpPort); + udpIpEndPoint = new IPEndPoint(IPAddress.Any, Config.serverList[serverName].UdpPort); try { udpClient = new UdpClient(udpIpEndPoint); } catch (SocketException _exception) { @@ -241,139 +242,4 @@ return socketStatus; } } - - //This class is non sence, is keeped cause of Time related question - //She will be removed, and DB setting should goes into the Master DB Object. - public class InSimSetting - { - private string _adminpass = ""; - private string _appname = ""; - private uint _autoreconnectdelay = 0xea60; - private char _commandprefix = '!'; - private InSim_Flag _flags; - private ushort _mci_nlp_interval = 500; - private ushort _portnumber = 0x752f; - private IPAddress _serverip = IPAddress.Any; - private ushort _udpreplyport = 0x2716; - - public InSimSetting(string ServerIP, ushort PortNumber, ushort UDPReplyPort, InSim_Flag Flags, char CommandPrefix, ushort MCI_NLP_Interval, string AdminPass, string AppName, uint AutoReconnectDelayInSeconds ) - { - this._serverip = IPAddress.Parse(ServerIP); - this._portnumber = PortNumber; - this._udpreplyport = UDPReplyPort; - this._flags = Flags; - this._commandprefix = CommandPrefix; - this._mci_nlp_interval = MCI_NLP_Interval; - this._adminpass = AdminPass; - this._appname = AppName; - this._autoreconnectdelay = (AutoReconnectDelayInSeconds == 0) ? 0 : (AutoReconnectDelayInSeconds * 0x3e8); - } - public string adminPassword - { - get - { - return this._adminpass; - } - set - { - this._adminpass = value; - } - } - - public string connectionName - { - get - { - return this._appname; - } - set - { - this._appname = value; - } - } - - public uint AutoReconnectDelay - { - get - { - return this._autoreconnectdelay; - } - set - { - this._autoreconnectdelay = value; - } - } - - public char CommandPrefix - { - get - { - return this._commandprefix; - } - set - { - this._commandprefix = value; - } - } - - public InSim_Flag Flags - { - get - { - return this._flags; - } - set - { - this._flags = value; - } - } - - public ushort MCI_NLP_Interval - { - get - { - return this._mci_nlp_interval; - } - set - { - this._mci_nlp_interval = value; - } - } - - public ushort tcpPort - { - get - { - return this._portnumber; - } - set - { - this._portnumber = value; - } - } - - public IPAddress serverIp - { - get - { - return this._serverip; - } - set - { - this._serverip = value; - } - } - - public ushort udpPort - { - get - { - return this._udpreplyport; - } - set - { - this._udpreplyport = value; - } - } - } } Index: src/server/command.cs =================================================================== --- src/server/command.cs (revision 36) +++ src/server/command.cs (working copy) @@ -22,19 +22,20 @@ //using Drive_LFSS.PacketStore_; using Drive_LFSS.Packet_; using Drive_LFSS.Game_; + using Drive_LFSS.Config_; sealed class CommandServer { - public CommandServer(ushort _serverId) + public CommandServer(string _serverName) { - serverId = _serverId; + serverName = _serverName; // CommandName CommandLevel CommandReference command["exit"] = new CommandName(0, new CommandDelegate(Exit)); command["kick"] = new CommandName(0, new CommandDelegate(Kick)); } - private ushort serverId; + private string serverName; private struct CommandName { public CommandName(byte _level, CommandDelegate _cmd) @@ -50,9 +51,9 @@ private Dictionary command = new Dictionary (); - public ushort GetServerId() + public string GetServerName() { - return serverId; + return serverName; } public void Exec(bool _adminStatus, string _licenceName, string _commandText) { @@ -61,7 +62,7 @@ if (args.Length < 1 || !command.ContainsKey(args[0].ToLower()) || (command[args[0]].level > 0 && !_adminStatus)) { - SessionList.sessionList[serverId].session.log.debug("Command.Exec(), Bad Command Call From User: " + _licenceName + ", AccessLevel: " + (_adminStatus ? "1" : "0") + ", CommandSend: " + _commandText + "\r\n"); + Config.serverList[serverName].session.log.debug("Command.Exec(), Bad Command Call From User: " + _licenceName + ", AccessLevel: " + (_adminStatus ? "1" : "0") + ", CommandSend: " + _commandText + "\r\n"); return; } command[args[0]].cmd(_adminStatus,_licenceName, _commandText); @@ -84,8 +85,8 @@ } args[0] = args[0].Substring(1); //Remove "Prefix Command String". - SessionList.sessionList[serverId].session.log.command("Command.Kick(), User: " + _licenceName + ", Kicked User: " + args[1] + "\r\n"); - SessionList.sessionList[serverId].session.AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_MST, Packet_Type.PACKET_MST_SEND_NORMAL_CHAT, new PacketMST("/kick " + args[1]))); + Config.serverList[serverName].session.log.command("Command.Kick(), User: " + _licenceName + ", Kicked User: " + args[1] + "\r\n"); + Config.serverList[serverName].session.AddToTcpSendingQueud(new Packet(Packet_Size.PACKET_SIZE_MST, Packet_Type.PACKET_MST_SEND_NORMAL_CHAT, new PacketMST("/kick " + args[1]))); } #endregion } Index: src/server/server.cs =================================================================== --- src/server/server.cs (revision 36) +++ src/server/server.cs (working copy) @@ -24,21 +24,22 @@ using Drive_LFSS.Log_; using Drive_LFSS.Packet_; using Drive_LFSS.Game_; + using Drive_LFSS.Config_; public abstract class Server : InSim { - public Server(ushort _serverId, InSimSetting _inSimSetting): base(_inSimSetting) + public Server(string _serverName): base(_serverName) { - serverId = _serverId; - log = new sLog(serverId); - command = new CommandServer(serverId); + serverName = _serverName; + log = new sLog(serverName); + command = new CommandServer(serverName); } public bool connectionRequest = true; //System that goes with this, is not good made... have to think it better way... later - private ushort serverId; - public ushort ServerId + private string serverName; + public string ServerName { - get { return serverId; } + get { return serverName; } } public sLog log; private CommandServer command;