コード例 #1
0
        protected void Initialize(string siteUrlsXmlFile)
        {
            string applicationPath = Globals.ApplicationPath;

            if (applicationPath != null)
            {
                applicationPath = applicationPath.Trim();
            }
            XmlDocument document = this.CreateDoc(siteUrlsXmlFile);

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

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

            this.CreateUrls(urls, transforms);
        }
コード例 #2
0
 private ExhibFlat.Core.Urls.LocationSet CreateLocationSet(XmlNode basePaths, string globalPath)
 {
     ExhibFlat.Core.Urls.LocationSet set = new ExhibFlat.Core.Urls.LocationSet();
     foreach (XmlNode node in basePaths.ChildNodes)
     {
         if (node.NodeType != XmlNodeType.Comment)
         {
             XmlAttribute attribute  = node.Attributes["name"];
             XmlAttribute attribute2 = node.Attributes["path"];
             XmlAttribute attribute3 = node.Attributes["physicalPath"];
             XmlAttribute attribute4 = node.Attributes["exclude"];
             XmlAttribute attribute5 = node.Attributes["type"];
             if ((attribute != null) && (attribute2 != null))
             {
                 string physicalPath = null;
                 if (attribute3 != null)
                 {
                     physicalPath = globalPath + attribute3.Value;
                 }
                 bool     exclude  = (attribute4 != null) && bool.Parse(attribute4.Value);
                 Location location = null;
                 string   path     = globalPath + attribute2.Value;
                 if (attribute5 == null)
                 {
                     location = new Location(path, physicalPath, exclude);
                 }
                 else
                 {
                     location = Activator.CreateInstance(Type.GetType(attribute5.Value), new object[] { path, physicalPath, exclude }) as Location;
                 }
                 set.Add(attribute.Value, location);
             }
         }
     }
     return(set);
 }