Ejemplo n.º 1
0
        private LocationSet CreateLocationSet(XmlNode basePaths, string globalPath)
        {
            LocationSet locationSet = new LocationSet();

            foreach (XmlNode xmlNode in basePaths.ChildNodes)
            {
                if (xmlNode.NodeType != XmlNodeType.Comment)
                {
                    XmlAttribute xmlAttribute  = xmlNode.Attributes["name"];
                    XmlAttribute xmlAttribute2 = xmlNode.Attributes["path"];
                    XmlAttribute xmlAttribute3 = xmlNode.Attributes["physicalPath"];
                    XmlAttribute xmlAttribute4 = xmlNode.Attributes["exclude"];
                    XmlAttribute xmlAttribute5 = xmlNode.Attributes["type"];
                    if (xmlAttribute != null && xmlAttribute2 != null)
                    {
                        string text = null;
                        if (xmlAttribute3 != null)
                        {
                            text = globalPath + xmlAttribute3.Value;
                        }
                        bool     flag  = xmlAttribute4 != null && bool.Parse(xmlAttribute4.Value);
                        string   text2 = globalPath + xmlAttribute2.Value;
                        Location location;
                        if (xmlAttribute5 == null)
                        {
                            location = new Location(text2, text, flag);
                        }
                        else
                        {
                            Type type = Type.GetType(xmlAttribute5.Value);
                            location = (Activator.CreateInstance(type, new object[]
                            {
                                text2,
                                text,
                                flag
                            }) as Location);
                        }
                        locationSet.Add(xmlAttribute.Value, location);
                    }
                }
            }
            return(locationSet);
        }
Ejemplo n.º 2
0
        protected void Initialize(string siteUrlsXmlFile)
        {
            string text = Globals.ApplicationPath;

            if (text != null)
            {
                text = text.Trim();
            }
            XmlDocument xmlDocument = this.CreateDoc(siteUrlsXmlFile);

            this.enableHtmRewrite = (string.Compare(xmlDocument.SelectSingleNode("SiteUrls").Attributes["enableHtmRewrite"].Value, "true", true) == 0);
            this.extension        = xmlDocument.SelectSingleNode("SiteUrls").Attributes["extension"].Value;
            XmlNode basePaths = xmlDocument.SelectSingleNode("SiteUrls/locations");

            this._locationSet    = this.CreateLocationSet(basePaths, text);
            this._locationFilter = this._locationSet.Filter;
            XmlNode        transformers = xmlDocument.SelectSingleNode("SiteUrls/transformers");
            ListDictionary transforms   = SiteUrlsData.CreateTransformers(transformers);
            XmlNode        urls         = xmlDocument.SelectSingleNode("SiteUrls/urls");

            this.CreateUrls(urls, transforms);
        }