Exemple #1
0
        static Dictionary <string, string> getConfig()
        {
            Dictionary <string, string> ret = new Dictionary <string, string>();
            string      xml    = TextFileComm.getFileText("config.xml", "xml");
            XmlDocument xmldoc = new XmlDocument();

            try
            {
                xmldoc.LoadXml(xml);
                XmlNode     root  = xmldoc.SelectSingleNode("root");
                XmlNodeList items = root.SelectNodes("system/item");
                foreach (XmlNode item in items)
                {
                    string key = XmlUtil.GetSubNodeText(item, "@key");
                    string val = XmlUtil.GetSubNodeText(item, "@value");
                    if (!ret.ContainsKey(key))
                    {
                        ret.Add(key, val);
                    }
                }
            }
            catch (Exception ce)
            {
                return(ret);
            }
            return(ret);
        }
Exemple #2
0
        static MutliLevelData getLotteryDic()
        {
            MutliLevelData ret    = new MutliLevelData();
            string         xml    = TextFileComm.getFileText("LotteryList.xml", "xml");
            XmlDocument    xmldoc = new XmlDocument();

            try
            {
                xmldoc.LoadXml(xml);
                XmlNode     root      = xmldoc.SelectSingleNode("root");
                XmlNodeList typenodes = root.SelectNodes("lotteryType/item");
                foreach (XmlNode typenode in typenodes)
                {
                    string  val  = XmlUtil.GetSubNodeText(typenode, "@value");
                    string  text = XmlUtil.GetSubNodeText(typenode, "@text");
                    KeyText k    = new KeyText(val, text);
                    if (ret.SubList.ContainsKey(k))
                    {
                        continue;
                    }
                    ret.SubList.Add(k, getNextLevel(root, val));
                }
            }
            catch (Exception ce)
            {
                return(ret);
            }
            return(ret);
        }
Exemple #3
0
        Dictionary <string, ActionDefine> getActionDictionary()
        {
            Dictionary <string, ActionDefine> ret = new Dictionary <string, ActionDefine>();
            string xml = TextFileComm.getFileText("MsgActionDic.xml", "xml");

            if (xml == null)
            {
                return(ret);
            }
            XmlDocument xmldoc = new XmlDocument();

            try
            {
                xmldoc.LoadXml(xml);
                XmlNode     root  = xmldoc.SelectSingleNode("root");
                XmlNodeList nlist = root.SelectNodes("action");
                foreach (XmlNode node in nlist)
                {
                    ActionDefine ad = new ActionDefine();

                    string type = XmlUtil.GetSubNodeText(node, "@type");
                    ad.actionName = type;
                    List <string> slist  = new List <string>();
                    XmlNodeList   snodes = node.SelectNodes("item");
                    foreach (XmlNode snode in snodes)
                    {
                        slist.Add(XmlUtil.GetSubNodeText(snode, "."));
                    }
                    ad.regConditions = slist;
                    snodes           = node.SelectNodes("response/case");
                    foreach (XmlNode snode in snodes)
                    {
                        ResponseProcessItem rpi = new ResponseProcessItem();
                        rpi.condition = XmlUtil.GetSubNodeText(snode, "condition");
                        rpi.isUrl     = XmlUtil.GetSubNodeText(snode, "isUrl");
                        rpi.type      = XmlUtil.GetSubNodeText(snode, "type");
                        rpi.msg       = XmlUtil.GetSubNodeText(snode, "msg");
                        rpi.paramList = XmlUtil.GetSubNodeText(snode, "paramList");
                        if (!ad.responseGroup.ContainsKey(rpi.condition))
                        {
                            ad.responseGroup.Add(rpi.condition, rpi);
                        }
                    }
                    if (!ret.ContainsKey(type))
                    {
                        ret.Add(type, ad);
                    }
                }
            }
            catch (Exception ce)
            {
                return(ret);
            }
            return(ret);
        }