System.Runtime.Remoting.MetadataServices.WsdlParser.ParseReaderStreamLocation C# (CSharp) Method

ParseReaderStreamLocation() private method

private ParseReaderStreamLocation ( ReaderStream reader, ReaderStream currentReaderStream ) : void
reader ReaderStream
currentReaderStream ReaderStream
return void
        private void ParseReaderStreamLocation(ReaderStream reader, ReaderStream currentReaderStream)
        {
            Util.Log("WsdlParser.ParseReaderStreamLocation location "+reader.Location+" current location "+currentReaderStream.Location);           
            String location = reader.Location;
            int index = location.IndexOf(':');
            if (index == -1)
            {
                // relative path
                if (currentReaderStream == null || currentReaderStream.Location == null)
                    throw new SUDSParserException(String.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Suds_Import"), reader.Location));

                if (currentReaderStream.Uri == null)
                    currentReaderStream.Uri= new Uri(currentReaderStream.Location); // If relative path, will already be changed to absolute path by next statement in previous invocation.
                Uri uri = new Uri(currentReaderStream.Uri, location);
                reader.Uri= uri;
                location = uri.ToString();
                index = location.IndexOf(':');
                if (index == -1)
                    return;
                reader.Location= location;
            }
            
            String protocol = location.Substring(0, index).ToLower(CultureInfo.InvariantCulture);
            String value = location.Substring(index+1);
            if (protocol == "file")
            {
                //Console.WriteLine("Loading file:" + value);
                reader.InputStream = new StreamReader(value);
            }
            else if (protocol.StartsWith("http", StringComparison.Ordinal))
            {
                Util.Log("WsdlParser.ParseReaderStreamLocation http "+location);            
                WebRequest request = WebRequest.Create(location);
                WebResponse response = request.GetResponse();
                Stream responseStream = response.GetResponseStream();
                reader.InputStream = new StreamReader(responseStream);
            }
        }