Exemplo n.º 1
0
        public void Initialize(IHttpServer server)
        {
            m_log.DebugFormat("[Wifi]: Initializing. Server at port {0}. Service is {1}", server.Port, Enabled ? "enabled" : "disabled");

            if (!Enabled)
            {
                return;
            }

            IConfig serverConfig = Config.Configs[ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section {0} in config file", ConfigName));
            }

            m_WifiMain = new WifiMain(Config, server, ConfigName);
        }
Exemplo n.º 2
0
        public void Initialise(IConfigSource config)
        {
            m_log.Info("[Wifi Module]: Initializing...");

            // We only load the configuration file if the config doesn't know about this module already
            IConfig wifiConfig = config.Configs["WifiService"];

            if (wifiConfig == null)
            {
                LoadConfiguration(config);
            }

            wifiConfig = config.Configs["WifiService"];
            if (wifiConfig == null)
            {
                throw new Exception("[Wifi Module]: Unable to find configuration. Service disabled.");
            }

            try
            {
                m_enabled = wifiConfig.GetBoolean("Enabled", m_enabled);
                if (m_enabled)
                {
                    m_WifiMain = new WifiMain(config, MainServer.Instance, string.Empty, this);
                    m_log.Debug("[Wifi Module]: Wifi enabled.");
                }
                else
                {
                    m_log.Debug("[Wifi Module]: Wifi disabled.");
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(e.StackTrace);
                m_log.ErrorFormat("[Wifi Module]: Could not load Wifi: {0}. ", e.Message);
                m_enabled = false;
                return;
            }
        }
Exemplo n.º 3
0
        public void Initialise(IConfigSource config)
        {
            m_log.Info("[Wifi Module]: Initializing...");

            // We only load the configuration file if the config doesn't know about this module already
            IConfig wifiConfig = config.Configs["WifiService"];
            if (wifiConfig == null)
                LoadConfiguration(config);

            wifiConfig = config.Configs["WifiService"];
            if (wifiConfig == null)
                throw new Exception("[Wifi Module]: Unable to find configuration. Service disabled.");

            try
            {
                m_enabled = wifiConfig.GetBoolean("Enabled", m_enabled);
                if (m_enabled)
                {
                    m_WifiMain = new WifiMain(config, MainServer.Instance, string.Empty, this);
                    m_log.Debug("[Wifi Module]: Wifi enabled.");
                }
                else
                    m_log.Debug("[Wifi Module]: Wifi disabled.");

            }
            catch (Exception e)
            {
                m_log.ErrorFormat(e.StackTrace);
                m_log.ErrorFormat("[Wifi Module]: Could not load Wifi: {0}. ", e.Message);
                m_enabled = false;
                return;
            }
        }
        public void Initialize(IHttpServer server)
        {
            m_log.DebugFormat("[Wifi]: Initializing. Server at port {0}. Service is {1}", server.Port, Enabled ? "enabled" : "disabled");

            if (!Enabled)
                return;

            IConfig serverConfig = Config.Configs[ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", ConfigName));

            m_WifiMain = new WifiMain(Config, server, ConfigName);
        }