IsSubsetOf() public méthode

public IsSubsetOf ( SiteString site ) : bool
site SiteString
Résultat bool
Exemple #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 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; 
        }
Exemple #2
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);
        }