示例#1
0
        public void Load(XmlDocument doc)
        {
            XmlElement elem = (XmlElement)doc.DocumentElement.ChildNodes[0];

            for (int i = 0; i < elem.ChildNodes.Count; i++)
            {
                XmlNode node = elem.ChildNodes[i];
                if (node is XmlElement)
                {
                    XmlElement     subNode = (XmlElement)node;
                    OpenTimePeriod period  = ReadTimePeriod(subNode);
                    dicOpenPeriod.Add(period.ID, period);
                }
            }

            XmlElement elemMarket = (XmlElement)doc.GetElementsByTagName("MARKETS")[0];

            for (int i = 0; i < elemMarket.ChildNodes.Count; i++)
            {
                XmlNode node = elemMarket.ChildNodes[i];
                if (node is XmlElement)
                {
                    XmlElement     subNode = (XmlElement)node;
                    OpenTimeMarket market  = new OpenTimeMarket();
                    market.Config = this;
                    market.LoadConfig(subNode);
                    Markets.Add(market);
                }
            }

            String openid = elem.GetAttribute("DEFAULT");

            this.defaultOpenTime = dicOpenPeriod[openid];
        }
示例#2
0
        public void LoadConfig(XmlElement elem)
        {
            this.ID = elem.GetAttribute("ID");
            String time = elem.GetAttribute("TIME");

            String[] timeArr = time.Split('-');
            string   str     = timeArr[0];

            if (str.Equals(""))
            {
                StartTime = int.MinValue;
            }
            else
            {
                StartTime = int.Parse(str);
            }

            str = timeArr[1];
            if (str.Equals(""))
            {
                EndTime = int.MaxValue;
            }
            else
            {
                EndTime = int.Parse(str);
            }

            string openid = elem.GetAttribute("OPENID");

            if (openid.Equals(""))
            {
                Period = Config.defaultOpenTime;
            }
            else
            {
                Period = Config.GetOpenPeriod(openid);
            }

            for (int i = 0; i < elem.ChildNodes.Count; i++)
            {
                XmlNode node = elem.ChildNodes[i];
                if (node is XmlElement)
                {
                    XmlElement      ee      = (XmlElement)node;
                    OpenTimeVariety variety = new OpenTimeVariety();
                    variety.BelongMarket = this;
                    variety.LoadConfig(ee);
                    varieties.Add(variety);
                }
            }
        }
示例#3
0
        private OpenTimePeriod ReadTimePeriod(XmlElement elem)
        {
            OpenTimePeriod period = new OpenTimePeriod();

            period.ID = elem.GetAttribute("ID");
            for (int i = 0; i < elem.ChildNodes.Count; i++)
            {
                XmlElement ee     = (XmlElement)elem.ChildNodes[i];
                double     fstart = double.Parse(ee.GetAttribute("START"));
                double     fend   = double.Parse(ee.GetAttribute("END"));
                double[]   ff     = new double[2];
                ff[0] = fstart;
                ff[1] = fend;
                period.OpenTime.Add(ff);
            }
            return(period);
        }
示例#4
0
        public void LoadConfig(XmlElement elem)
        {
            String IDStr = elem.GetAttribute("ID");

            String[] ids = IDStr.Split(',');
            foreach (String id in ids)
            {
                set.Add(id);
            }
            String time = elem.GetAttribute("TIME");

            String[] timeArr = time.Split('-');
            string   str     = timeArr[0];

            if (str.Equals(""))
            {
                StartTime = int.MinValue;
            }
            else
            {
                StartTime = int.Parse(str);
            }

            str = timeArr[1];
            if (str.Equals(""))
            {
                EndTime = int.MaxValue;
            }
            else
            {
                EndTime = int.Parse(str);
            }

            string openid = elem.GetAttribute("OPENID");

            if (openid.Equals(""))
            {
                Period = BelongMarket.Period;
            }
            else
            {
                Period = BelongMarket.Config.GetOpenPeriod(openid);
            }
        }