Ejemplo n.º 1
0
 private void CreateUrls(XmlNode urls, ListDictionary transforms)
 {
     foreach (XmlNode node in urls.ChildNodes)
     {
         if (node.NodeType != XmlNodeType.Comment)
         {
             bool         flag      = this.enableHtmRewrite && ((node.Attributes["htmRewrite"] != null) && (string.Compare(node.Attributes["htmRewrite"].Value, "true", true) == 0));
             string       name      = node.Attributes["name"].Value;
             XmlAttribute attribute = node.Attributes["navigateUrl"];
             if (attribute != null)
             {
                 this._paths.Add(name, attribute.Value);
             }
             else
             {
                 string       str5;
                 string       str2       = node.Attributes["location"].Value;
                 string       str3       = null;
                 string       str4       = null;
                 XmlAttribute attribute2 = node.Attributes["vanity"];
                 XmlAttribute attribute3 = node.Attributes["pattern"];
                 Location     location   = this._locationSet.FindLocationByName(str2);
                 if ((attribute2 != null) && (attribute3 != null))
                 {
                     str4 = location.Path + attribute3.Value;
                     str3 = location.PhysicalPath + attribute2.Value;
                 }
                 if (flag)
                 {
                     str5 = node.Attributes["path"].Value.Replace(".aspx", this.extension);
                     if (string.IsNullOrEmpty(str4) || string.IsNullOrEmpty(str3))
                     {
                         str4 = location.Path + node.Attributes["path"].Value;
                         str3 = location.PhysicalPath + node.Attributes["path"].Value;
                     }
                     str4 = str4.Replace(".aspx", this.extension);
                 }
                 else
                 {
                     str5 = node.Attributes["path"].Value;
                 }
                 foreach (string str6 in transforms.Keys)
                 {
                     str5 = str5.Replace(str6, transforms[str6].ToString());
                     if (!string.IsNullOrEmpty(str4))
                     {
                         str4 = str4.Replace(str6, transforms[str6].ToString());
                     }
                     if (!string.IsNullOrEmpty(str3))
                     {
                         str3 = str3.Replace(str6, transforms[str6].ToString());
                     }
                 }
                 this._paths.Add(name, location.Path + str5);
                 string str7 = location.Path + str5;
                 if (Globals.ApplicationPath.Length > 0)
                 {
                     str7 = str7.Replace(Globals.ApplicationPath, "").ToLower(CultureInfo.InvariantCulture);
                 }
                 this._reversePaths.Add(str7, name);
                 if (!(string.IsNullOrEmpty(str4) || string.IsNullOrEmpty(str3)))
                 {
                     location.Add(new ReWrittenUrl(str2 + "." + name, str4, str3));
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void CreateUrls(XmlNode urls, ListDictionary transforms)
 {
     foreach (XmlNode xmlNode in urls.ChildNodes)
     {
         if (xmlNode.NodeType != XmlNodeType.Comment)
         {
             bool         flag         = this.enableHtmRewrite && xmlNode.Attributes["htmRewrite"] != null && string.Compare(xmlNode.Attributes["htmRewrite"].Value, "true", true) == 0;
             string       value        = xmlNode.Attributes["name"].Value;
             XmlAttribute xmlAttribute = xmlNode.Attributes["navigateUrl"];
             if (xmlAttribute != null)
             {
                 this._paths.Add(value, xmlAttribute.Value);
             }
             else
             {
                 string       value2        = xmlNode.Attributes["location"].Value;
                 string       text          = null;
                 string       text2         = null;
                 XmlAttribute xmlAttribute2 = xmlNode.Attributes["vanity"];
                 XmlAttribute xmlAttribute3 = xmlNode.Attributes["pattern"];
                 Location     location      = this._locationSet.FindLocationByName(value2);
                 if (xmlAttribute2 != null && xmlAttribute3 != null)
                 {
                     text2 = location.Path + xmlAttribute3.Value;
                     text  = location.PhysicalPath + xmlAttribute2.Value;
                 }
                 string text3;
                 if (flag)
                 {
                     text3 = xmlNode.Attributes["path"].Value.Replace(".aspx", this.extension);
                     if (string.IsNullOrEmpty(text2) || string.IsNullOrEmpty(text))
                     {
                         text2 = location.Path + xmlNode.Attributes["path"].Value;
                         text  = location.PhysicalPath + xmlNode.Attributes["path"].Value;
                     }
                     text2 = text2.Replace(".aspx", this.extension);
                 }
                 else
                 {
                     text3 = xmlNode.Attributes["path"].Value;
                 }
                 foreach (string text4 in transforms.Keys)
                 {
                     text3 = text3.Replace(text4, transforms[text4].ToString());
                     if (!string.IsNullOrEmpty(text2))
                     {
                         text2 = text2.Replace(text4, transforms[text4].ToString());
                     }
                     if (!string.IsNullOrEmpty(text))
                     {
                         text = text.Replace(text4, transforms[text4].ToString());
                     }
                 }
                 this._paths.Add(value, location.Path + text3);
                 string text5 = location.Path + text3;
                 if (Globals.ApplicationPath.Length > 0)
                 {
                     text5 = text5.Replace(Globals.ApplicationPath, "").ToLower(CultureInfo.InvariantCulture);
                 }
                 this._reversePaths.Add(text5, value);
                 if (!string.IsNullOrEmpty(text2) && !string.IsNullOrEmpty(text))
                 {
                     location.Add(new ReWrittenUrl(value2 + "." + value, text2, text));
                 }
             }
         }
     }
 }