public static void Parse(string uri, out string scheme, out string userName,
                                 out string password, out string serverName, out int?port, out string parentUri, out string path, out string query)
        {
            int y;
            var x = uri.IndexOf("://", StringComparison.Ordinal);

            if (x < 0)
            {
                throw new MalformedUriException(uri);
            }

            if (x == uri.Length - 1)
            {
                throw new MalformedUriException(uri);
            }

            scheme = uri.Substring(0, x);

            x = ParseNetworkPart(uri, x + 3, out userName, out password, out serverName, out port);

            if (uri[x] == '/')
            {
                x++;
            }

            if (x >= uri.Length || (x < uri.Length && uri[x] != '['))
            {
                y         = x;
                parentUri = "";
            }
            else
            {
                y = ParseParentUri(uri, x);

                parentUri = uri.Substring(x + 1, y - x - 1);

                if (Local.LocalNodeAddress.CanParse(parentUri))
                {
                    if (parentUri.IndexOf("://") < 0)
                    {
                        parentUri = "file://" + TextConversion.ToEscapedHexString(parentUri, TextConversion.IsStandardUrlEscapedChar);
                    }
                    else
                    {
                        parentUri = TextConversion.ToReEscapedHexString(parentUri, TextConversion.IsStandardUrlEscapedChar);
                    }
                }
                else
                {
                    parentUri = TextConversion.ToReEscapedHexString(parentUri, TextConversion.IsStandardUrlEscapedChar);
                }
            }

            if (y + 1 >= uri.Length)
            {
                path  = "/";
                query = "";
            }
            else
            {
                if (uri[y + 1] != FileSystemManager.SeperatorChar)
                {
                    throw new MalformedUriException();
                }

                path = uri.Substring(y + 1);

                if ((x = path.IndexOf('?')) >= 0)
                {
                    query = path.Substring(x + 1);
                    path  = path.Substring(0, x);
                }
                else
                {
                    query = "";
                }
            }
        }