DoDeferredParse() private method

private DoDeferredParse ( ) : void
return void
Example #1
0
        internal URLString SpecialNormalizeUrl()
        {
            this.DoDeferredParse();
            if (string.Compare(this.m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(this);
            }
            string @string = this.m_localSite.ToString();

            if (@string.Length != 2 || (int)@string[1] != 124 && (int)@string[1] != 58)
            {
                return(this);
            }
            string s = (string)null;

            URLString.GetDeviceName(@string, JitHelpers.GetStringHandleOnStack(ref s));
            if (s == null)
            {
                return(this);
            }
            if (s.IndexOf("://", StringComparison.Ordinal) != -1)
            {
                URLString urlString = new URLString(s + "/" + this.m_directory.ToString());
                urlString.DoDeferredParse();
                return(urlString);
            }
            URLString urlString1 = new URLString("file://" + s + "/" + this.m_directory.ToString());

            urlString1.DoDeferredParse();
            return(urlString1);
        }
Example #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));
        }
Example #3
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));
        }
        internal URLString SpecialNormalizeUrl()
        {
            this.DoDeferredParse();
            if (string.Compare(this.m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(this);
            }
            string text = this.m_localSite.ToString();

            if (text.Length != 2 || (text[1] != '|' && text[1] != ':'))
            {
                return(this);
            }
            string text2 = null;

            URLString.GetDeviceName(text, JitHelpers.GetStringHandleOnStack(ref text2));
            if (text2 == null)
            {
                return(this);
            }
            if (text2.IndexOf("://", StringComparison.Ordinal) != -1)
            {
                URLString urlstring = new URLString(text2 + "/" + this.m_directory.ToString());
                urlstring.DoDeferredParse();
                return(urlstring);
            }
            URLString urlstring2 = new URLString("file://" + text2 + "/" + this.m_directory.ToString());

            urlstring2.DoDeferredParse();
            return(urlstring2);
        }
        internal URLString SpecialNormalizeUrl()
        {
            this.DoDeferredParse();
            if (string.Compare(this.m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(this);
            }
            string driveLetter = this.m_localSite.ToString();

            if ((driveLetter.Length != 2) || ((driveLetter[1] != '|') && (driveLetter[1] != ':')))
            {
                return(this);
            }
            string s = null;

            GetDeviceName(driveLetter, JitHelpers.GetStringHandleOnStack(ref s));
            if (s == null)
            {
                return(this);
            }
            if (s.IndexOf("://", StringComparison.Ordinal) != -1)
            {
                URLString str3 = new URLString(s + "/" + this.m_directory.ToString());
                str3.DoDeferredParse();
                return(str3);
            }
            URLString str4 = new URLString("file://" + s + "/" + this.m_directory.ToString());

            str4.DoDeferredParse();
            return(str4);
        }
        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));
        }
Example #7
0
        internal URLString SpecialNormalizeUrl()
        {
            // Under WinXP, file protocol urls can be mapped to
            // drives that aren't actually file protocol underneath
            // due to drive mounting.  This code attempts to figure
            // out what a drive is mounted to and create the
            // url is maps to.

            DoDeferredParse();
            if (String.Compare(m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(this);
            }
            else
            {
                String localSite = m_localSite.ToString();

                if (localSite.Length == 2 &&
                    (localSite[1] == '|' ||
                     localSite[1] == ':'))
                {
                    String deviceName = null;
                    GetDeviceName(localSite, JitHelpers.GetStringHandleOnStack(ref deviceName));

                    if (deviceName != null)
                    {
                        if (deviceName.IndexOf("://", StringComparison.Ordinal) != -1)
                        {
                            URLString u = new URLString(deviceName + "/" + this.m_directory.ToString());
                            u.DoDeferredParse(); // Presumably the caller of SpecialNormalizeUrl wants a fully parsed URL
                            return(u);
                        }
                        else
                        {
                            URLString u = new URLString("file://" + deviceName + "/" + this.m_directory.ToString());
                            u.DoDeferredParse();// Presumably the caller of SpecialNormalizeUrl wants a fully parsed URL
                            return(u);
                        }
                    }
                    else
                    {
                        return(this);
                    }
                }
                else
                {
                    return(this);
                }
            }
        }
Example #8
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);
            }
        }
 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));
 }
Example #10
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);
        }
Example #11
0
        internal URLString SpecialNormalizeUrl() 
        { 
            // Under WinXP, file protocol urls can be mapped to
            // drives that aren't actually file protocol underneath 
            // due to drive mounting.  This code attempts to figure
            // out what a drive is mounted to and create the
            // url is maps to.
 
            DoDeferredParse();
            if (String.Compare( m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0) 
            { 
                return this;
            } 
            else
            {
                String localSite = m_localSite.ToString();
 
                if (localSite.Length == 2 &&
                    (localSite[1] == '|' || 
                     localSite[1] == ':')) 
                {
                    String deviceName = null; 
                    GetDeviceName(localSite, JitHelpers.GetStringHandleOnStack(ref deviceName));

                    if (deviceName != null)
                    { 
                        if (deviceName.IndexOf( "://", StringComparison.Ordinal ) != -1)
                        { 
                            URLString u = new URLString( deviceName + "/" + this.m_directory.ToString() ); 
                            u.DoDeferredParse(); // Presumably the caller of SpecialNormalizeUrl wants a fully parsed URL
                            return u; 
                        }
                        else
                        {
                            URLString u = new URLString( "file://" + deviceName + "/" + this.m_directory.ToString() ); 
                            u.DoDeferredParse();// Presumably the caller of SpecialNormalizeUrl wants a fully parsed URL
                            return u; 
                        } 
                    }
                    else 
                        return this;
                }
                else
                { 
                    return this;
                } 
            } 
        }
Example #12
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; 
        }
 internal URLString SpecialNormalizeUrl()
 {
     this.DoDeferredParse();
     if (string.Compare(this.m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0)
     {
         return this;
     }
     string driveLetter = this.m_localSite.ToString();
     if ((driveLetter.Length != 2) || ((driveLetter[1] != '|') && (driveLetter[1] != ':')))
     {
         return this;
     }
     string s = null;
     GetDeviceName(driveLetter, JitHelpers.GetStringHandleOnStack(ref s));
     if (s == null)
     {
         return this;
     }
     if (s.IndexOf("://", StringComparison.Ordinal) != -1)
     {
         URLString str3 = new URLString(s + "/" + this.m_directory.ToString());
         str3.DoDeferredParse();
         return str3;
     }
     URLString str4 = new URLString("file://" + s + "/" + this.m_directory.ToString());
     str4.DoDeferredParse();
     return str4;
 }