System.Security.Util.URLString.ParseFileURL C# (CSharp) Method

ParseFileURL() private method

private ParseFileURL ( String url ) : void
url String
return void
        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;
        }