示例#1
0
        private void ParseNonFileURL(string url)
        {
            string site1  = url;
            int    length = site1.IndexOf('/');

            if (length == -1)
            {
                this.m_localSite  = (LocalSiteString)null;
                this.m_siteString = new SiteString(site1);
                this.m_directory  = new DirectoryString();
            }
            else
            {
                string site2 = site1.Substring(0, length);
                this.m_localSite  = (LocalSiteString)null;
                this.m_siteString = new SiteString(site2);
                string directory = site1.Substring(length + 1);
                if (directory.Length == 0)
                {
                    this.m_directory = new DirectoryString();
                }
                else
                {
                    this.m_directory = new DirectoryString(directory, false);
                }
            }
        }
示例#2
0
        private void ParseNonFileURL(String url)
        {
            String temp  = url;
            int    index = temp.IndexOf('/');

            if (index == -1)
            {
                m_localSite  = null;   // for drive letter
                m_siteString = new SiteString(temp);
                m_directory  = new DirectoryString();
            }
            else
            {
                String site = temp.Substring(0, index);
                m_localSite  = null;
                m_siteString = new SiteString(site);

                String directoryString = temp.Substring(index + 1);

                if (directoryString.Length == 0)
                {
                    m_directory = new DirectoryString();
                }
                else
                {
                    m_directory = new DirectoryString(directoryString, false);
                }
            }
            return;
        }
        private void ParseNonFileURL(string url)
        {
            string site  = url;
            int    index = site.IndexOf('/');

            if (index == -1)
            {
                this.m_localSite  = null;
                this.m_siteString = new SiteString(site);
                this.m_directory  = new DirectoryString();
            }
            else
            {
                string str2 = site.Substring(0, index);
                this.m_localSite  = null;
                this.m_siteString = new SiteString(str2);
                string directory = site.Substring(index + 1);
                if (directory.Length == 0)
                {
                    this.m_directory = new DirectoryString();
                }
                else
                {
                    this.m_directory = new DirectoryString(directory, false);
                }
            }
        }
示例#4
0
 public URLString()
 {
     m_protocol   = "";
     m_siteString = new SiteString();
     m_port       = -1;
     m_localSite  = null;
     m_directory  = new DirectoryString();
     m_fullurl    = "";
 }
示例#5
0
        private void ParseFileURL(string url)
        {
            string str1   = url;
            int    length = str1.IndexOf('/');

            if (length != -1 && (length == 2 && (int)str1[length - 1] != 58 && (int)str1[length - 1] != 124 || length != 2) && length != str1.Length - 1)
            {
                int num = str1.IndexOf('/', length + 1);
                length = num == -1 ? -1 : num;
            }
            string strIn = length != -1 ? str1.Substring(0, length) : str1;

            if (strIn.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
            }
            bool flag1;
            int  index1;

            if ((int)strIn[0] == 92 && (int)strIn[1] == 92)
            {
                flag1  = true;
                index1 = 2;
            }
            else
            {
                index1 = 0;
                flag1  = false;
            }
            bool flag2 = true;

            for (; index1 < strIn.Length; ++index1)
            {
                char ch = strIn[index1];
                if (((int)ch < 65 || (int)ch > 90) && ((int)ch < 97 || (int)ch > 122) && (((int)ch < 48 || (int)ch > 57) && ((int)ch != 45 && (int)ch != 47)) && ((int)ch != 58 && (int)ch != 124 && ((int)ch != 46 && (int)ch != 42) && ((int)ch != 36 && (!flag1 || (int)ch != 32))))
                {
                    flag2 = false;
                    break;
                }
            }
            string site = !flag2?strIn.ToUpper(CultureInfo.InvariantCulture) : string.SmallCharToUpper(strIn);

            this.m_localSite = new LocalSiteString(site);
            if (length == -1)
            {
                string str2   = site;
                int    index2 = str2.Length - 1;
                this.m_directory = (int)str2[index2] != 42 ? new DirectoryString() : new DirectoryString("*", false);
            }
            else
            {
                string directory = str1.Substring(length + 1);
                this.m_directory = directory.Length != 0 ? new DirectoryString(directory, true) : new DirectoryString();
            }
            this.m_siteString = (SiteString)null;
        }
 public URLString()
 {
     this.m_protocol = "";
     this.m_userpass = "";
     this.m_siteString = new SiteString();
     this.m_port = -1;
     this.m_localSite = null;
     this.m_directory = new DirectoryString();
     this.m_parseDeferred = false;
 }
示例#7
0
 public URLString()
 {
     m_protocol      = "";
     m_userpass      = "";
     m_siteString    = new SiteString();
     m_port          = -1;
     m_localSite     = null;
     m_directory     = new DirectoryString();
     m_parseDeferred = false;
 }
示例#8
0
 public URLString()
 {
     this.m_protocol      = "";
     this.m_userpass      = "";
     this.m_siteString    = new SiteString();
     this.m_port          = -1;
     this.m_localSite     = (LocalSiteString)null;
     this.m_directory     = new DirectoryString();
     this.m_parseDeferred = false;
 }
示例#9
0
        public URLString()
        {
            m_protocol = "";
            m_siteString = new SiteString();
            m_port = -1;
#if !PLATFORM_UNIX
            m_localSite = null;
#endif // !PLATFORM_UNIX
            m_directory = new DirectoryString();
            m_fullurl = "";
        }
示例#10
0
        public URLString()
        {
            m_protocol   = "";
            m_siteString = new SiteString();
            m_port       = -1;
#if !PLATFORM_UNIX
            m_localSite = null;
#endif // !PLATFORM_UNIX
            m_directory = new DirectoryString();
            m_fullurl   = "";
        }
示例#11
0
        public URLString()
        {
            m_protocol   = "";
            m_userpass   = "";
            m_siteString = new SiteString();
            m_port       = -1;
#if !PLATFORM_UNIX
            m_localSite = null;
#endif // !PLATFORM_UNIX
            m_directory     = new DirectoryString();
            m_parseDeferred = false;
        }
 public virtual bool IsSubsetOf(LocalSiteString operand, bool ignoreCase)
 {
     if (operand == null)
     {
         return false;
     }
     if (operand.m_separatedSite.Count == 0)
     {
         return ((base.m_separatedSite.Count == 0) || ((base.m_separatedSite.Count > 0) && (string.Compare((string) base.m_separatedSite[0], "*", StringComparison.Ordinal) == 0)));
     }
     if (base.m_separatedSite.Count == 0)
     {
         return (string.Compare((string) operand.m_separatedSite[0], "*", StringComparison.Ordinal) == 0);
     }
     return base.IsSubsetOf(operand, ignoreCase);
 }
 public virtual bool IsSubsetOf(LocalSiteString operand, bool ignoreCase)
 {
     if (operand == null)
     {
         return(false);
     }
     if (operand.m_separatedSite.Count == 0)
     {
         return((base.m_separatedSite.Count == 0) || ((base.m_separatedSite.Count > 0) && (string.Compare((string)base.m_separatedSite[0], "*", StringComparison.Ordinal) == 0)));
     }
     if (base.m_separatedSite.Count == 0)
     {
         return(string.Compare((string)operand.m_separatedSite[0], "*", StringComparison.Ordinal) == 0);
     }
     return(base.IsSubsetOf(operand, ignoreCase));
 }
示例#14
0
 public virtual bool IsSubsetOf(LocalSiteString operand, bool ignoreCase)
 {
     if (operand == null)
     {
         return(false);
     }
     else if (operand.m_separatedSite.Count == 0)
     {
         return(this.m_separatedSite.Count == 0 || this.m_separatedSite.Count > 0 && String.Compare((String)this.m_separatedSite[0], "*", StringComparison.Ordinal) == 0);
     }
     else if (this.m_separatedSite.Count == 0)
     {
         return(String.Compare((String)operand.m_separatedSite[0], "*", StringComparison.Ordinal) == 0);
     }
     else
     {
         return(base.IsSubsetOf(operand, ignoreCase));
     }
 }
示例#15
0
        private void ParseFileURL(String url)
        {
            String temp = url;

            int index = temp.IndexOf('/');

            if (index != -1 &&
                ((index == 2 &&
                  temp[index - 1] != ':' &&
                  temp[index - 1] != '|') ||
                 index != 2) &&
                index != temp.Length - 1)
            {
                // Also, if it is a UNC share, we want m_localSite to
                // be of the form "computername/share", so if the first
                // fileEnd character found is a slash, do some more parsing
                // to find the proper end character.

                int tempIndex = temp.IndexOf('/', index + 1);

                if (tempIndex != -1)
                {
                    index = tempIndex;
                }
                else
                {
                    index = -1;
                }
            }

            String localSite;

            if (index == -1)
            {
                localSite = temp;
            }
            else
            {
                localSite = temp.Substring(0, index);
            }

            if (localSite.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
            }

            int  i;
            bool spacesAllowed;

            if (localSite[0] == '\\' && localSite[1] == '\\')
            {
                spacesAllowed = true;
                i             = 2;
            }
            else
            {
                i             = 0;
                spacesAllowed = false;
            }

            bool useSmallCharToUpper = true;

            for (; i < localSite.Length; ++i)
            {
                char c = localSite[i];

                if ((c >= 'A' && c <= 'Z') ||
                    (c >= 'a' && c <= 'z') ||
                    (c >= '0' && c <= '9') ||
                    (c == '-') || (c == '/') ||
                    (c == ':') || (c == '|') ||
                    (c == '.') || (c == '*') ||
                    (c == '$') || (spacesAllowed && c == ' '))
                {
                    continue;
                }
                else
                {
                    useSmallCharToUpper = false;
                    break;
                }
            }

            if (useSmallCharToUpper)
            {
                localSite = String.SmallCharToUpper(localSite);
            }
            else
            {
                localSite = localSite.ToUpper(CultureInfo.InvariantCulture);
            }

            m_localSite = new LocalSiteString(localSite);

            if (index == -1)
            {
                if (localSite[localSite.Length - 1] == '*')
                {
                    m_directory = new DirectoryString("*", false);
                }
                else
                {
                    m_directory = new DirectoryString();
                }
            }
            else
            {
                String directoryString = temp.Substring(index + 1);
                if (directoryString.Length == 0)
                {
                    m_directory = new DirectoryString();
                }
                else
                {
                    m_directory = new DirectoryString(directoryString, true);
                }
            }

            m_siteString = null;
            return;
        }
示例#16
0
 public virtual bool IsSubsetOf(LocalSiteString operand)
 {
     return(this.IsSubsetOf(operand, true));
 }
示例#17
0
        public URLString() 
        {
            m_protocol = ""; 
            m_userpass = "";
            m_siteString = new SiteString();
            m_port = -1;
#if !PLATFORM_UNIX 
            m_localSite = null;
#endif // !PLATFORM_UNIX 
            m_directory = new DirectoryString(); 
            m_parseDeferred = false;
        } 
示例#18
0
        private void ParseNonFileURL(String url)
        { 
            String temp = url;
            int index = temp.IndexOf('/'); 
 
            if (index == -1)
            { 
#if !PLATFORM_UNIX
                m_localSite = null;    // for drive letter
#endif // !PLATFORM_UNIX
                m_siteString = new SiteString( temp ); 
                m_directory = new DirectoryString();
            } 
            else 
            {
#if !PLATFORM_UNIX 
                String site = temp.Substring( 0, index );
                m_localSite = null;
                m_siteString = new SiteString( site );
 
                String directoryString = temp.Substring( index + 1 );
 
                if (directoryString.Length == 0) 
                {
                    m_directory = new DirectoryString(); 
                }
                else
                {
                    m_directory = new DirectoryString( directoryString, false ); 
                }
#else 
                String directoryString = temp.Substring( index + 1 ); 
                String site = temp.Substring( 0, index );
                m_directory = new DirectoryString( directoryString, false ); 
                m_siteString = new SiteString( site );
#endif //!PLATFORM_UNIX
            }
            return; 
        }
示例#19
0
        private void ParseFileURL(String url) 
        {
 
            String temp = url; 
#if !PLATFORM_UNIX
            int index = temp.IndexOf( '/'); 

            if (index != -1 &&
                ((index == 2 &&
                  temp[index-1] != ':' && 
                  temp[index-1] != '|') ||
                 index != 2) && 
                index != temp.Length - 1) 
            {
                // Also, if it is a UNC share, we want m_localSite to 
                // be of the form "computername/share", so if the first
                // fileEnd character found is a slash, do some more parsing
                // to find the proper end character.
 
                int tempIndex = temp.IndexOf( '/', index+1);
 
                if (tempIndex != -1) 
                    index = tempIndex;
                else 
                    index = -1;
            }

            String localSite; 
            if (index == -1)
                localSite = temp; 
            else 
                localSite = temp.Substring(0,index);
 
            if (localSite.Length == 0)
                throw new ArgumentException( Environment.GetResourceString( "Argument_InvalidUrl" ) );

            int i; 
            bool spacesAllowed;
 
            if (localSite[0] == '\\' && localSite[1] == '\\') 
            {
                spacesAllowed = true; 
                i = 2;
            }
            else
            { 
                i = 0;
                spacesAllowed = false; 
            } 

            bool useSmallCharToUpper = true; 

            for (; i < localSite.Length; ++i)
            {
                char c = localSite[i]; 

                if ((c >= 'A' && c <= 'Z') || 
                    (c >= 'a' && c <= 'z') || 
                    (c >= '0' && c <= '9') ||
                    (c == '-') || (c == '/') || 
                    (c == ':') || (c == '|') ||
                    (c == '.') || (c == '*') ||
                    (c == '$') || (spacesAllowed && c == ' '))
                { 
                    continue;
                } 
                else 
                {
                    useSmallCharToUpper = false; 
                    break;
                }
            }
 
            if (useSmallCharToUpper)
                localSite = String.SmallCharToUpper( localSite ); 
            else 
                localSite = localSite.ToUpper(CultureInfo.InvariantCulture);
 
            m_localSite = new LocalSiteString( localSite );

            if (index == -1)
            { 
                if (localSite[localSite.Length-1] == '*')
                    m_directory = new DirectoryString( "*", false ); 
                else 
                    m_directory = new DirectoryString();
            } 
            else
            {
                String directoryString = temp.Substring( index + 1 );
                if (directoryString.Length == 0) 
                {
                    m_directory = new DirectoryString(); 
                } 
                else
                { 
                    m_directory = new DirectoryString( directoryString, true);
                }
            }
#else // !PLATFORM_UNIX 
            m_directory = new DirectoryString( temp, true);
#endif // !PLATFORM_UNIX 
 
            m_siteString = null;
            return; 
        }
示例#20
0
 public virtual bool IsSubsetOf( LocalSiteString operand ) 
 {
     return this.IsSubsetOf( operand, true );
 }
 private void ParseNonFileURL(string url)
 {
     string site = url;
     int index = site.IndexOf('/');
     if (index == -1)
     {
         this.m_localSite = null;
         this.m_siteString = new SiteString(site);
         this.m_directory = new DirectoryString();
     }
     else
     {
         string str2 = site.Substring(0, index);
         this.m_localSite = null;
         this.m_siteString = new SiteString(str2);
         string directory = site.Substring(index + 1);
         if (directory.Length == 0)
         {
             this.m_directory = new DirectoryString();
         }
         else
         {
             this.m_directory = new DirectoryString(directory, false);
         }
     }
 }
        private void ParseFileURL(string url)
        {
            string str2;
            int    num3;
            bool   flag;
            string str   = url;
            int    index = str.IndexOf('/');

            if (((index != -1) && ((((index == 2) && (str[index - 1] != ':')) && (str[index - 1] != '|')) || (index != 2))) && (index != (str.Length - 1)))
            {
                int num2 = str.IndexOf('/', index + 1);
                if (num2 != -1)
                {
                    index = num2;
                }
                else
                {
                    index = -1;
                }
            }
            if (index == -1)
            {
                str2 = str;
            }
            else
            {
                str2 = str.Substring(0, index);
            }
            if (str2.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
            }
            if ((str2[0] == '\\') && (str2[1] == '\\'))
            {
                flag = true;
                num3 = 2;
            }
            else
            {
                num3 = 0;
                flag = false;
            }
            bool flag2 = true;

            while (num3 < str2.Length)
            {
                char ch = str2[num3];
                if ((((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z'))) && (((ch < '0') || (ch > '9')) && (((((ch != '-') && (ch != '/')) && ((ch != ':') && (ch != '|'))) && (((ch != '.') && (ch != '*')) && (ch != '$'))) && (!flag || (ch != ' ')))))
                {
                    flag2 = false;
                    break;
                }
                num3++;
            }
            if (flag2)
            {
                str2 = string.SmallCharToUpper(str2);
            }
            else
            {
                str2 = str2.ToUpper(CultureInfo.InvariantCulture);
            }
            this.m_localSite = new LocalSiteString(str2);
            if (index == -1)
            {
                if (str2[str2.Length - 1] == '*')
                {
                    this.m_directory = new DirectoryString("*", false);
                }
                else
                {
                    this.m_directory = new DirectoryString();
                }
            }
            else
            {
                string directory = str.Substring(index + 1);
                if (directory.Length == 0)
                {
                    this.m_directory = new DirectoryString();
                }
                else
                {
                    this.m_directory = new DirectoryString(directory, true);
                }
            }
            this.m_siteString = null;
        }
 private void ParseFileURL(string url)
 {
     string str2;
     int num3;
     bool flag;
     string str = url;
     int index = str.IndexOf('/');
     if (((index != -1) && ((((index == 2) && (str[index - 1] != ':')) && (str[index - 1] != '|')) || (index != 2))) && (index != (str.Length - 1)))
     {
         int num2 = str.IndexOf('/', index + 1);
         if (num2 != -1)
         {
             index = num2;
         }
         else
         {
             index = -1;
         }
     }
     if (index == -1)
     {
         str2 = str;
     }
     else
     {
         str2 = str.Substring(0, index);
     }
     if (str2.Length == 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
     }
     if ((str2[0] == '\\') && (str2[1] == '\\'))
     {
         flag = true;
         num3 = 2;
     }
     else
     {
         num3 = 0;
         flag = false;
     }
     bool flag2 = true;
     while (num3 < str2.Length)
     {
         char ch = str2[num3];
         if ((((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z'))) && (((ch < '0') || (ch > '9')) && (((((ch != '-') && (ch != '/')) && ((ch != ':') && (ch != '|'))) && (((ch != '.') && (ch != '*')) && (ch != '$'))) && (!flag || (ch != ' ')))))
         {
             flag2 = false;
             break;
         }
         num3++;
     }
     if (flag2)
     {
         str2 = string.SmallCharToUpper(str2);
     }
     else
     {
         str2 = str2.ToUpper(CultureInfo.InvariantCulture);
     }
     this.m_localSite = new LocalSiteString(str2);
     if (index == -1)
     {
         if (str2[str2.Length - 1] == '*')
         {
             this.m_directory = new DirectoryString("*", false);
         }
         else
         {
             this.m_directory = new DirectoryString();
         }
     }
     else
     {
         string directory = str.Substring(index + 1);
         if (directory.Length == 0)
         {
             this.m_directory = new DirectoryString();
         }
         else
         {
             this.m_directory = new DirectoryString(directory, true);
         }
     }
     this.m_siteString = null;
 }
示例#24
0
 public virtual bool IsSubsetOf( LocalSiteString operand, bool ignoreCase )
 { 
     if (operand == null) 
     {
         return false; 
     }
     else if (operand.m_separatedSite.Count == 0)
     {
         return this.m_separatedSite.Count == 0 || this.m_separatedSite.Count > 0 && String.Compare((String)this.m_separatedSite[0], "*", StringComparison.Ordinal) == 0; 
     }
     else if (this.m_separatedSite.Count == 0) 
     { 
         return String.Compare((String)operand.m_separatedSite[0], "*", StringComparison.Ordinal) == 0;
     } 
     else
     {
         return base.IsSubsetOf( operand, ignoreCase );
     } 
 }
示例#25
0
        void ParseString(String url, bool parsed)
        {
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            if (url.Length == 0)
            {
                throw new FormatException(Environment.GetResourceString("Format_StringZeroLength"));
            }

            int    index;
            String temp         = url;
            String intermediate = "";

            // If there are any hex or unicode characters in the url, translate those
            // into the proper character.

            if (!parsed)
            {
                do
                {
                    index = temp.IndexOf('%');

                    if (index == -1)
                    {
                        intermediate += temp;
                        break;
                    }

                    if (temp.Length - index < 1)
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
                    }

                    if (temp[index + 1] == 'u' || temp[index + 1] == 'U')
                    {
                        if (temp.Length - index < 5)
                        {
                            throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
                        }

                        // We have a unicode character specified in hex

                        char c = (char)(Hex.ConvertHexDigit(temp[index + 2]) << 12 |
                                        Hex.ConvertHexDigit(temp[index + 3]) << 8 |
                                        Hex.ConvertHexDigit(temp[index + 4]) << 4 |
                                        Hex.ConvertHexDigit(temp[index + 5]));

                        intermediate += temp.Substring(0, index) + c;
                        temp          = temp.Substring(index + 6);
                    }
                    else
                    {
                        // we have a hex character.

                        if (temp.Length - index < 2)
                        {
                            throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
                        }

                        char c = (char)(Hex.ConvertHexDigit(temp[index + 1]) << 4 | Hex.ConvertHexDigit(temp[index + 2]));

                        intermediate += temp.Substring(0, index) + c;
                        temp          = temp.Substring(index + 3);
                    }
                } while (true);

                temp = intermediate;
                url  = temp;
            }


            // Search for the end of the protocol info and grab the actual protocol string
            // ex. http://www.microsoft.com/complus would have a protocol string of http

            index = temp.IndexOf(':');

            if (index == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
            }
            else if (index != -1 &&
                     temp.Length > index + 1)
            {
                if (String.Compare(temp.Substring(0, index), "file", true, CultureInfo.InvariantCulture) == 0)
                {
                    m_protocol = "file";
                    temp       = temp.Substring(index + 1);
                }
                else if (temp[index + 1] != '\\')
                {
                    if (temp.Length > index + 2 &&
                        temp[index + 1] == '/' &&
                        temp[index + 2] == '/')
                    {
                        m_protocol = url.Substring(0, index);

                        for (int i = 0; i < m_protocol.Length; ++i)
                        {
                            char c = m_protocol[i];

                            if ((c >= 'a' && c <= 'z') ||
                                (c >= 'A' && c <= 'Z'))
                            {
                                continue;
                            }
                            else
                            {
                                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
                            }
                        }

                        temp = url.Substring(index + 3);
                    }
                    else
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
                    }
                }
                else
                {
                    m_protocol = m_defaultProtocol;
                    temp       = url;
                }
            }
            else
            {
                m_protocol = m_defaultProtocol;
                temp       = url;
            }

            // Parse out the site info.
            // In the general case we parse of the site and create a SiteString out of it
            // (which supports our wildcarding scheme).  In the case of files we don't support
            // wildcarding and furthermore SiteString doesn't like ':' and '|' which can appear
            // in file urls so we just keep that info in a separate string and set the
            // SiteString to null.
            //
            // ex. http://www.microsoft.com/complus  -> m_siteString = "www.microsoft.com" m_localSite = null
            // ex. file:///c:/complus/mscorlib.dll  -> m_siteString = null m_localSite = "c:"
            // ex. file:///c|/complus/mscorlib.dll  -> m_siteString = null m_localSite = "c:"

            bool fileProtocol;

            if (String.Compare(m_protocol, "file", true, CultureInfo.InvariantCulture) == 0)
            {
                index        = temp.IndexOfAny(m_fileEnd);
                fileProtocol = true;

                if (String.Compare(temp, 0, "\\\\?\\", 0, 4, true, CultureInfo.InvariantCulture) == 0 ||
                    String.Compare(temp, 0, "\\\\.\\", 0, 4, true, CultureInfo.InvariantCulture) == 0)
                {
                    temp = temp.Substring(4);
                }
            }
            else
            {
                index        = temp.IndexOfAny(m_siteEnd);
                fileProtocol = false;
            }

            temp = temp.Replace('\\', '/');

            // If we find a '/' in the first character of the string and we are using the 'file'
            // protocol, just ignore it.

            if (fileProtocol)
            {
                // Remove any '/' before the local site information.
                // ex. file://///d:/complus
                // ex. file:///d:/complus

                temp = temp.TrimStart(new char[] { '/' });

                index = temp.IndexOfAny(m_fileEnd, 0);

                if (index != -1 &&
                    ((index == 2 &&
                      temp[index - 1] != ':' &&
                      temp[index - 1] != '|') ||
                     index != 2) &&
                    index != temp.Length - 1)
                {
                    int tempIndex = temp.Substring(index + 1).IndexOfAny(m_fileEnd);

                    if (tempIndex != -1)
                    {
                        index = tempIndex + index + 1;
                    }
                    else
                    {
                        index = -1;
                    }
                }
            }

            // Check if there is a port number and parse that out.

            if (index != -1 && temp[index] == ':')
            {
                int tempIndex = temp.IndexOf('/');

                if (tempIndex == -1)
                {
                    m_port = Int32.Parse(temp.Substring(index + 1));

                    if (m_port < 0)
                    {
                        throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUrl"));
                    }

                    temp  = temp.Substring(0, index);
                    index = -1;
                }
                else
                {
                    m_port = Int32.Parse(temp.Substring(index + 1, tempIndex - index - 1));
                    temp   = temp.Substring(0, index) + temp.Substring(tempIndex);
                }
            }

            if (index == -1)
            {
                if (fileProtocol)
                {
                    String localSite = temp;

                    int  i;
                    bool spacesAllowed;

                    if (localSite[0] == '\\' && localSite[1] == '\\')
                    {
                        spacesAllowed = true;
                        i             = 2;
                    }
                    else
                    {
                        i             = 0;
                        spacesAllowed = false;
                    }

                    bool useSmallCharToUpper = true;

                    for (; i < localSite.Length; ++i)
                    {
                        char c = localSite[i];

                        if ((c >= 'A' && c <= 'Z') ||
                            (c >= 'a' && c <= 'z') ||
                            (c >= '0' && c <= '9') ||
                            (c == '-') || (c == '/') ||
                            (c == ':') || (c == '|') ||
                            (c == '.') || (c == '*') ||
                            (c == '$') || (spacesAllowed && c == ' '))
                        {
                            continue;
                        }
                        else
                        {
                            useSmallCharToUpper = false;
                            break;
                        }
                    }


                    if (useSmallCharToUpper)
                    {
                        localSite = String.SmallCharToUpper(localSite);
                    }
                    else
                    {
                        localSite = localSite.ToUpper(CultureInfo.InvariantCulture);
                    }

                    m_siteString = null;
                    m_localSite  = new LocalSiteString(localSite);

                    if (localSite[localSite.Length - 1] == '*')
                    {
                        m_directory = new DirectoryString("*", false);
                    }
                    else
                    {
                        m_directory = new DirectoryString();
                    }
                }
                else
                {
                    m_localSite  = null;
                    m_siteString = new SiteString(temp);
                    m_directory  = new DirectoryString();
                }
            }
            else
            {
                String site = temp.Substring(0, index);

                if (fileProtocol)
                {
                    String localSite = site;

                    int  i;
                    bool spacesAllowed;

                    if (localSite[0] == '\\' && localSite[1] == '\\')
                    {
                        spacesAllowed = true;
                        i             = 2;
                    }
                    else
                    {
                        i             = 0;
                        spacesAllowed = false;
                    }

                    bool useSmallCharToUpper = true;

                    for (; i < localSite.Length; ++i)
                    {
                        char c = localSite[i];

                        if ((c >= 'A' && c <= 'Z') ||
                            (c >= 'a' && c <= 'z') ||
                            (c >= '-' && c <= ':') ||
                            (c == '|') || (c == '$') ||
                            (c == '_') ||
                            (spacesAllowed && c == ' '))
                        {
                            continue;
                        }
                        else
                        {
                            useSmallCharToUpper = false;
                            break;
                        }
                    }

                    if (useSmallCharToUpper)
                    {
                        localSite = String.SmallCharToUpper(localSite);
                    }
                    else
                    {
                        localSite = localSite.ToUpper(CultureInfo.InvariantCulture);
                    }

                    m_siteString = null;
                    m_localSite  = new LocalSiteString(localSite);
                }
                else
                {
                    m_localSite  = null;
                    m_siteString = new SiteString(site);
                }

                // Finally we parse out the directory string
                // ex. http://www.microsoft.com/complus -> m_directory = "complus"

                String directoryString = temp.Substring(index + 1);

                if (directoryString.Length == 0)
                {
                    m_directory = new DirectoryString();
                }
                else
                {
                    m_directory = new DirectoryString(directoryString, fileProtocol);
                }
            }

            String builtUrl;

            if (fileProtocol)
            {
                String directory = m_directory.ToString();
                String localSite = m_localSite.ToString();

                builtUrl = "file://" + localSite;

                if (directory != null && !directory.Equals("") && (!directory.Equals("*") || localSite.IndexOf('*') == -1))
                {
                    builtUrl += "/" + directory;
                }
            }
            else
            {
                builtUrl = m_protocol + "://" + m_siteString.ToString();

                if (m_port != -1)
                {
                    builtUrl += ":" + m_port;
                }

                builtUrl += "/" + m_directory.ToString();
            }

            m_fullurl = builtUrl;
        }