private void ParseReaderStreamLocation(ReaderStream reader)
{
Util.Log("SdlParser.ParseReaderStreamLocation");
String location = reader.Location;
int index = location.IndexOf(':');
if(index != -1)
{
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"))
{
//Console.WriteLine("Loading " + protocol + ':' + value);
/*
// Setup proxy settings
DefaultControlObject proxyObject = new DefaultControlObject();
proxyObject.ProxyNoLocal = true;
GlobalProxySelection.Select = proxyObject;
*/
WebRequest request = WebRequest.Create(location);
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
reader.InputStream = new StreamReader(responseStream);
}
}
return;
}