Beispiel #1
0
        private void TryParse()
        {
            //Discarded unreachable code: IL_02d1
            ConfigData configData = new ConfigData();

            try
            {
                XMLNodeList xMLNodeList = rootNode["SmartFoxConfig"] as XMLNodeList;
                XMLNode     xMLNode     = xMLNodeList[0] as XMLNode;
                if (GetNodeText(xMLNode, "host") == null)
                {
                    smartFox.Log.Error("Required config node missing: host");
                }
                if (GetNodeText(xMLNode, "port") == null)
                {
                    smartFox.Log.Error("Required config node missing: port");
                }
                if (GetNodeText(xMLNode, "udpHost") == null)
                {
                    smartFox.Log.Error("Required config node missing: udpHost");
                }
                if (GetNodeText(xMLNode, "udpPort") == null)
                {
                    smartFox.Log.Error("Required config node missing: udpPort");
                }
                if (GetNodeText(xMLNode, "zone") == null)
                {
                    smartFox.Log.Error("Required config node missing: zone");
                }
                configData.Host    = GetNodeText(xMLNode, "host");
                configData.Port    = Convert.ToInt32(GetNodeText(xMLNode, "port"));
                configData.UdpHost = GetNodeText(xMLNode, "udpHost");
                configData.UdpPort = Convert.ToInt32(GetNodeText(xMLNode, "udpPort"));
                configData.Zone    = GetNodeText(xMLNode, "zone");
                if (GetNodeText(xMLNode, "debug") != null)
                {
                    configData.Debug = GetNodeText(xMLNode, "debug").ToLower() == "true";
                }
                if (GetNodeText(xMLNode, "useBlueBox") != null)
                {
                    configData.UseBlueBox = GetNodeText(xMLNode, "useBlueBox").ToLower() == "true";
                }
                if (GetNodeText(xMLNode, "httpPort") != null && GetNodeText(xMLNode, "httpPort") != "")
                {
                    configData.HttpPort = Convert.ToInt32(GetNodeText(xMLNode, "httpPort"));
                }
                if (GetNodeText(xMLNode, "httpsPort") != null && GetNodeText(xMLNode, "httpsPort") != "")
                {
                    configData.HttpsPort = Convert.ToInt32(GetNodeText(xMLNode, "httpsPort"));
                }
                if (GetNodeText(xMLNode, "blueBoxPollingRate") != null && GetNodeText(xMLNode, "blueBoxPollingRate") != "")
                {
                    configData.BlueBoxPollingRate = Convert.ToInt32(GetNodeText(xMLNode, "blueBoxPollingRate"));
                }
            }
            catch (Exception ex)
            {
                OnConfigLoadFailure("Error parsing config file: " + ex.Message + " " + ex.StackTrace);
                return;
            }
            Hashtable hashtable = new Hashtable();

            hashtable["cfg"] = configData;
            SFSEvent evt = new SFSEvent(SFSEvent.CONFIG_LOAD_SUCCESS, hashtable);

            dispatcher.DispatchEvent(evt);
        }