SpecialNormalizeUrl() private method

private SpecialNormalizeUrl ( ) : URLString
return URLString
示例#1
0
        public static bool CompareUrls(URLString url1, URLString url2)
        {
            if (url1 == null && url2 == null)
            {
                return(true);
            }
            if (url1 == null || url2 == null)
            {
                return(false);
            }
            url1.DoDeferredParse();
            url2.DoDeferredParse();
            URLString urlString1 = url1.SpecialNormalizeUrl();
            URLString urlString2 = url2.SpecialNormalizeUrl();

            if (string.Compare(urlString1.m_protocol, urlString2.m_protocol, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }
            if (string.Compare(urlString1.m_protocol, "file", StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (!urlString1.m_localSite.IsSubsetOf(urlString2.m_localSite) || !urlString2.m_localSite.IsSubsetOf(urlString1.m_localSite))
                {
                    return(false);
                }
            }
            else if (string.Compare(urlString1.m_userpass, urlString2.m_userpass, StringComparison.Ordinal) != 0 || !urlString1.m_siteString.IsSubsetOf(urlString2.m_siteString) || (!urlString2.m_siteString.IsSubsetOf(urlString1.m_siteString) || url1.m_port != url2.m_port))
            {
                return(false);
            }
            return(urlString1.m_directory.IsSubsetOf(urlString2.m_directory) && urlString2.m_directory.IsSubsetOf(urlString1.m_directory));
        }
示例#2
0
        public override bool IsSubsetOf(SiteString site)
        {
            if (site == null)
            {
                return(false);
            }
            URLString urlString1 = site as URLString;

            if (urlString1 == null)
            {
                return(false);
            }
            this.DoDeferredParse();
            urlString1.DoDeferredParse();
            URLString urlString2 = this.SpecialNormalizeUrl();
            URLString urlString3 = urlString1.SpecialNormalizeUrl();

            if (string.Compare(urlString2.m_protocol, urlString3.m_protocol, StringComparison.OrdinalIgnoreCase) != 0 || !urlString2.m_directory.IsSubsetOf(urlString3.m_directory))
            {
                return(false);
            }
            if (urlString2.m_localSite != null)
            {
                return(urlString2.m_localSite.IsSubsetOf(urlString3.m_localSite));
            }
            if (urlString2.m_port != urlString3.m_port || urlString3.m_siteString == null)
            {
                return(false);
            }
            return(urlString2.m_siteString.IsSubsetOf(urlString3.m_siteString));
        }
        public override bool IsSubsetOf(SiteString site)
        {
            if (site == null)
            {
                return(false);
            }
            URLString str = site as URLString;

            if (str == null)
            {
                return(false);
            }
            this.DoDeferredParse();
            str.DoDeferredParse();
            URLString str2 = this.SpecialNormalizeUrl();
            URLString str3 = str.SpecialNormalizeUrl();

            if ((string.Compare(str2.m_protocol, str3.m_protocol, StringComparison.OrdinalIgnoreCase) != 0) || !str2.m_directory.IsSubsetOf(str3.m_directory))
            {
                return(false);
            }
            if (str2.m_localSite != null)
            {
                return(str2.m_localSite.IsSubsetOf(str3.m_localSite));
            }
            if (str2.m_port != str3.m_port)
            {
                return(false);
            }
            return((str3.m_siteString != null) && str2.m_siteString.IsSubsetOf(str3.m_siteString));
        }
示例#4
0
        public static bool CompareUrls(URLString url1, URLString url2)
        {
            if (url1 == null && url2 == null)
            {
                return(true);
            }

            if (url1 == null || url2 == null)
            {
                return(false);
            }

            URLString normalUrl1 = url1.SpecialNormalizeUrl();
            URLString normalUrl2 = url2.SpecialNormalizeUrl();

            // Compare protocol (case insensitive)

            if (String.Compare(normalUrl1.m_protocol, normalUrl2.m_protocol, true, CultureInfo.InvariantCulture) != 0)
            {
                return(false);
            }

            // Do special processing for file urls

            if (String.Compare(normalUrl1.m_protocol, "file", true, CultureInfo.InvariantCulture) == 0)
            {
                return(normalUrl1.m_localSite.IsSubsetOf(normalUrl2.m_localSite) &&
                       normalUrl2.m_localSite.IsSubsetOf(normalUrl1.m_localSite));
            }
            else
            {
                if (!normalUrl1.m_siteString.IsSubsetOf(normalUrl2.m_siteString) ||
                    !normalUrl2.m_siteString.IsSubsetOf(normalUrl1.m_siteString))
                {
                    return(false);
                }

                if (url1.m_port != url2.m_port)
                {
                    return(false);
                }
            }

            if (!normalUrl1.m_directory.IsSubsetOf(normalUrl2.m_directory) ||
                !normalUrl2.m_directory.IsSubsetOf(normalUrl1.m_directory))
            {
                return(false);
            }

            return(true);
        }
示例#5
0
        public override bool IsSubsetOf(SiteString site)
        {
            if (site == null)
            {
                return(false);
            }

            URLString url = site as URLString;

            if (url == null)
            {
                return(false);
            }

            DoDeferredParse();
            url.DoDeferredParse();

            URLString normalUrl1 = this.SpecialNormalizeUrl();
            URLString normalUrl2 = url.SpecialNormalizeUrl();

            if (String.Compare(normalUrl1.m_protocol, normalUrl2.m_protocol, StringComparison.OrdinalIgnoreCase) == 0 &&
                normalUrl1.m_directory.IsSubsetOf(normalUrl2.m_directory))
            {
#if !PLATFORM_UNIX
                if (normalUrl1.m_localSite != null)
                {
                    // We do a little extra processing in here for local files since we allow
                    // both <drive_letter>: and <drive_letter>| forms of urls.

                    return(normalUrl1.m_localSite.IsSubsetOf(normalUrl2.m_localSite));
                }
                else
#endif // !PLATFORM_UNIX
                {
                    if (normalUrl1.m_port != normalUrl2.m_port)
                    {
                        return(false);
                    }

                    return(normalUrl2.m_siteString != null && normalUrl1.m_siteString.IsSubsetOf(normalUrl2.m_siteString));
                }
            }
            else
            {
                return(false);
            }
        }
示例#6
0
        public override bool IsSubsetOf(SiteString site)
        {
            if (site == null)
            {
                return(false);
            }

            URLString url = site as URLString;

            if (url == null)
            {
                return(false);
            }

            URLString normalUrl1 = this.SpecialNormalizeUrl();
            URLString normalUrl2 = url.SpecialNormalizeUrl();

            if (String.Compare(normalUrl1.m_protocol, normalUrl2.m_protocol, true, CultureInfo.InvariantCulture) == 0 &&
                normalUrl1.m_directory.IsSubsetOf(normalUrl2.m_directory))
            {
                if (normalUrl1.m_localSite != null)
                {
                    // We do a little extra processing in here for local files since we allow
                    // both <drive_letter>: and <drive_letter>| forms of urls.

                    return(normalUrl1.m_localSite.IsSubsetOf(normalUrl2.m_localSite));
                }
                else
                {
                    if (normalUrl1.m_port != normalUrl2.m_port)
                    {
                        return(false);
                    }

                    return(normalUrl2.m_siteString != null && normalUrl1.m_siteString.IsSubsetOf(normalUrl2.m_siteString));
                }
            }
            else
            {
                return(false);
            }
        }
 public static bool CompareUrls(URLString url1, URLString url2)
 {
     if ((url1 == null) && (url2 == null))
     {
         return true;
     }
     if ((url1 == null) || (url2 == null))
     {
         return false;
     }
     url1.DoDeferredParse();
     url2.DoDeferredParse();
     URLString str = url1.SpecialNormalizeUrl();
     URLString str2 = url2.SpecialNormalizeUrl();
     if (string.Compare(str.m_protocol, str2.m_protocol, StringComparison.OrdinalIgnoreCase) != 0)
     {
         return false;
     }
     if (string.Compare(str.m_protocol, "file", StringComparison.OrdinalIgnoreCase) == 0)
     {
         if (!str.m_localSite.IsSubsetOf(str2.m_localSite) || !str2.m_localSite.IsSubsetOf(str.m_localSite))
         {
             return false;
         }
     }
     else
     {
         if (string.Compare(str.m_userpass, str2.m_userpass, StringComparison.Ordinal) != 0)
         {
             return false;
         }
         if (!str.m_siteString.IsSubsetOf(str2.m_siteString) || !str2.m_siteString.IsSubsetOf(str.m_siteString))
         {
             return false;
         }
         if (url1.m_port != url2.m_port)
         {
             return false;
         }
     }
     return (str.m_directory.IsSubsetOf(str2.m_directory) && str2.m_directory.IsSubsetOf(str.m_directory));
 }
示例#8
0
        public static bool CompareUrls(URLString url1, URLString url2)
        {
            if (url1 == null && url2 == null)
            {
                return(true);
            }

            if (url1 == null || url2 == null)
            {
                return(false);
            }

            url1.DoDeferredParse();
            url2.DoDeferredParse();

            URLString normalUrl1 = url1.SpecialNormalizeUrl();
            URLString normalUrl2 = url2.SpecialNormalizeUrl();

            // Compare protocol (case insensitive)

            if (String.Compare(normalUrl1.m_protocol, normalUrl2.m_protocol, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }

            // Do special processing for file urls

            if (String.Compare(normalUrl1.m_protocol, "file", StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (!normalUrl1.m_localSite.IsSubsetOf(normalUrl2.m_localSite) ||
                    !normalUrl2.m_localSite.IsSubsetOf(normalUrl1.m_localSite))
                {
                    return(false);
                }
            }
            else
            {
                if (String.Compare(normalUrl1.m_userpass, normalUrl2.m_userpass, StringComparison.Ordinal) != 0)
                {
                    return(false);
                }

                if (!normalUrl1.m_siteString.IsSubsetOf(normalUrl2.m_siteString) ||
                    !normalUrl2.m_siteString.IsSubsetOf(normalUrl1.m_siteString))
                {
                    return(false);
                }

                if (url1.m_port != url2.m_port)
                {
                    return(false);
                }
            }

            if (!normalUrl1.m_directory.IsSubsetOf(normalUrl2.m_directory) ||
                !normalUrl2.m_directory.IsSubsetOf(normalUrl1.m_directory))
            {
                return(false);
            }

            return(true);
        }
示例#9
0
        public static bool CompareUrls( URLString url1, URLString url2 )
        { 
            if (url1 == null && url2 == null) 
                return true;
 
            if (url1 == null || url2 == null)
                return false;

            url1.DoDeferredParse(); 
            url2.DoDeferredParse();
 
            URLString normalUrl1 = url1.SpecialNormalizeUrl(); 
            URLString normalUrl2 = url2.SpecialNormalizeUrl();
 
            // Compare protocol (case insensitive)

            if (String.Compare( normalUrl1.m_protocol, normalUrl2.m_protocol, StringComparison.OrdinalIgnoreCase) != 0)
                return false; 

            // Do special processing for file urls 
 
            if (String.Compare( normalUrl1.m_protocol, "file", StringComparison.OrdinalIgnoreCase) == 0)
            { 
#if !PLATFORM_UNIX
                if (!normalUrl1.m_localSite.IsSubsetOf( normalUrl2.m_localSite ) ||
                    !normalUrl2.m_localSite.IsSubsetOf( normalUrl1.m_localSite ))
                     return false; 
#else
                return url1.IsSubsetOf( url2 ) && 
                       url2.IsSubsetOf( url1 ); 
#endif // !PLATFORM_UNIX
            } 
            else
            {
                if (String.Compare( normalUrl1.m_userpass, normalUrl2.m_userpass, StringComparison.Ordinal) != 0)
                    return false; 

                if (!normalUrl1.m_siteString.IsSubsetOf( normalUrl2.m_siteString ) || 
                    !normalUrl2.m_siteString.IsSubsetOf( normalUrl1.m_siteString )) 
                    return false;
 
                if (url1.m_port != url2.m_port)
                    return false;
            }
 
            if (!normalUrl1.m_directory.IsSubsetOf( normalUrl2.m_directory ) ||
                !normalUrl2.m_directory.IsSubsetOf( normalUrl1.m_directory )) 
                return false; 

            return true; 
        }