示例#1
0
        public bool Init()
        {
            Log.write(TLog.Normal, "Loading Server Configuration");
            _config = new Xmlconfig("server.xml", false).Settings;

            _json    = _config["responder/load"].boolValue;
            _jsonURI = _config["responder/bindURI"].Value;

            //Have to know the URI first
            if (_json)
            {
                httpJsonResponder = new HttpJsonResponder(this);
            }

            String _connectionString = _config["database/connectionString"].Value;

            //Connect to our database
            Log.write("Connecting to database...");
            db = new SqlConnection(_connectionString);
            db.Open();
            if (db.State != System.Data.ConnectionState.Open)
            {
                Log.write("Connection failed.");
                return(false);
            }

            grabZones();

            return(true);
        }