예제 #1
0
        public AllowChartRequest()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(System.Web.HttpContext.Current.Server.MapPath("/HandlerMapping/AllowChartRequest.config"));

            this.Domains = new DomainCollection();

            if (xmlDoc != null && xmlDoc.DocumentElement.ChildNodes.Count > 0)
            {
                XmlNodeList nodeDomains = xmlDoc.DocumentElement.SelectNodes("//AllowDomains/AllowDomain");

                for (int domainIndex = 0; domainIndex < nodeDomains.Count; domainIndex++)
                {
                    string domainName = nodeDomains[domainIndex].Attributes["domain"].Value;
                    Domain newDomain = new Domain(domainName);

                    XmlNodeList nodeCharts = nodeDomains[domainIndex].SelectNodes("//chart");

                    for (int chartIndex = 0; chartIndex < nodeCharts.Count; chartIndex++)
                    {
                        string file = nodeCharts[chartIndex].Attributes["file"].Value;
                        string parameters = nodeCharts[chartIndex].Attributes["params"].Value;
                        int cacheExpiration = Lib.Object2Integer(nodeCharts[chartIndex].Attributes["cache"].Value);
                        
                        JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                        List<string> listOfParams = new List<string>();
                        if (parameters != "")
                        {
                            listOfParams = jsSerializer.Deserialize<List<string>>("[" + parameters + "]");
                        }

                        newDomain.Charts.Add(new Chart(file, cacheExpiration, listOfParams.ToArray()));
                    }

                    this.Domains.Add(newDomain);
                }
            }
        }
예제 #2
0
 public void Add(Domain item)
 {
     this.List.Add(item);
 }