Ejemplo n.º 1
0
        public static int RmtNumber; //使用

        #endregion Fields

        #region Constructors

        static BaseConfig()
        {
            try
            {
                string configFile = AppDomain.CurrentDomain.BaseDirectory + "UserRegisterSetting.xml";

                Dictionary<string, NotifySrv> mapPlayNotify = new Dictionary<string, NotifySrv>();

                if (System.IO.File.Exists(configFile))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(configFile);

                    PlayId = Convert.ToInt32(xmlDoc.SelectSingleNode("RegSetting/PlayId").InnerText);
                    ConnStr = xmlDoc.SelectSingleNode("RegSetting/ConnStr").InnerText;
                    rmtAdminKey = xmlDoc.SelectSingleNode("RegSetting/rmtAdminKey").InnerText;
                    CurrentRmtServerKey =xmlDoc.SelectSingleNode("RegSetting/CurrentRmtServerKey").InnerText;

                    RmtNumber = Convert.ToInt32(xmlDoc.SelectSingleNode("RegSetting/RmtNumber").InnerText);
                    int nAllowReg = Convert.ToInt32(xmlDoc.SelectSingleNode("RegSetting/AllowReg").InnerText);
                    if (nAllowReg == 0)
                        bAllowReg = false;
                    else
                        bAllowReg = true;

                    XmlNode node = xmlDoc.SelectSingleNode("RegSetting/NotifySrv");
                    foreach (XmlNode s in node.ChildNodes)
                    {
                        switch (s.Name.ToLower())
                        {
                            case "add":
                                int key = Convert.ToInt32(s.Attributes["key"].Value.Trim());
                                int playId = Convert.ToInt32(s.Attributes["PlayId"].Value.Trim());
                                string DataBaseChar = s.Attributes["DataBaseChar"].Value.Trim();
                                string ri = s.Attributes["ri"].Value.Trim();
                                if (!mapNotifySrv.ContainsKey(playId))
                                    mapNotifySrv.Add(playId, new Dictionary<string, NotifySrv>());
                                if (mapNotifySrv[playId].ContainsKey(DataBaseChar))
                                    mapNotifySrv[playId][DataBaseChar] = new NotifySrv(DataBaseChar,  ri);
                                else
                                    mapNotifySrv[playId].Add(DataBaseChar, new NotifySrv(DataBaseChar,  ri));

                                break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Loger.Debug(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        static BaseConfig()
        {
            try
            {
                string configFile = AppDomain.CurrentDomain.BaseDirectory + "UserRegisterSetting.xml";

                Dictionary <string, NotifySrv> mapPlayNotify = new Dictionary <string, NotifySrv>();

                if (System.IO.File.Exists(configFile))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(configFile);

                    PlayId              = Convert.ToInt32(xmlDoc.SelectSingleNode("RegSetting/PlayId").InnerText);
                    ConnStr             = xmlDoc.SelectSingleNode("RegSetting/ConnStr").InnerText;
                    rmtAdminKey         = xmlDoc.SelectSingleNode("RegSetting/rmtAdminKey").InnerText;
                    CurrentRmtServerKey = xmlDoc.SelectSingleNode("RegSetting/CurrentRmtServerKey").InnerText;

                    RmtNumber = Convert.ToInt32(xmlDoc.SelectSingleNode("RegSetting/RmtNumber").InnerText);
                    int nAllowReg = Convert.ToInt32(xmlDoc.SelectSingleNode("RegSetting/AllowReg").InnerText);
                    if (nAllowReg == 0)
                    {
                        bAllowReg = false;
                    }
                    else
                    {
                        bAllowReg = true;
                    }

                    XmlNode node = xmlDoc.SelectSingleNode("RegSetting/NotifySrv");
                    foreach (XmlNode s in node.ChildNodes)
                    {
                        switch (s.Name.ToLower())
                        {
                        case "add":
                            int    key          = Convert.ToInt32(s.Attributes["key"].Value.Trim());
                            int    playId       = Convert.ToInt32(s.Attributes["PlayId"].Value.Trim());
                            string DataBaseChar = s.Attributes["DataBaseChar"].Value.Trim();
                            string ri           = s.Attributes["ri"].Value.Trim();
                            if (!mapNotifySrv.ContainsKey(playId))
                            {
                                mapNotifySrv.Add(playId, new Dictionary <string, NotifySrv>());
                            }
                            if (mapNotifySrv[playId].ContainsKey(DataBaseChar))
                            {
                                mapNotifySrv[playId][DataBaseChar] = new NotifySrv(DataBaseChar, ri);
                            }
                            else
                            {
                                mapNotifySrv[playId].Add(DataBaseChar, new NotifySrv(DataBaseChar, ri));
                            }

                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Loger.Debug(ex.ToString());
            }
        }