示例#1
0
        /// <summary>
        /// Allows the server to preload all assets.
        /// </summary>
        public bool init()
        {       //Load our server config
            Log.write(TLog.Normal, "Loading Server Configuration");
            _config = new Xmlconfig("server.xml", false).Settings;

            //Load protocol config settings
            Client.udpMaxSize = _config["protocol/udpMaxSize"].intValue;
            Client.crcLength  = _config["protocol/crcLength"].intValue;
            if (Client.crcLength > 4)
            {
                Log.write(TLog.Error, "Invalid protocol/crcLength, must be less than 4.");
                return(false);
            }

            Client.connectionTimeout = _config["protocol/connectionTimeout"].intValue;

            bAllowMulticlienting = _config["allowMulticlienting"].boolValue;

            //Attempt to connect to our database
            _connectionString = _config["database/connectionString"].Value;

            //Does the database exist?
            using (InfantryDataContext db = getContext())
            {
                if (!db.DatabaseExists())
                {       //Create a new one
                    Log.write(TLog.Warning, "Database layout doesn't exist, creating..");

                    db.CreateDatabase();
                }
            }

            //We're good!
            Log.write("Connected to database.");
            return(true);
        }
示例#2
0
 /// <summary>
 /// Adds a child node to the xml tree
 /// </summary>
 public void AddChild(ConfigSetting child)
 {               //Add it!
     node.AppendChild(node.OwnerDocument.ImportNode(child.node, true));
 }