- searcharoo_5.zip
- EPocalipse.IFilter
- Mono.GetOptions
- bin
- Release
- Mono.GetOptions.dll
- GetOptTest
- Mono.GetOptions.csproj
- Mono.GetOptions.Useful
- Mono.GetOptions
- Mono
- Properties
- Searcharoo.Indexer
- Searcharoo.sln
- Searcharoo
- AllDiagram.cd
- bin
- Release
- EPocalipse.IFilter.dll
- Searcharoo.dll
- Common
- Core_CatalogWordFile.cd
- DocumentDiagram.cd
- Engine
- Indexer
- IndexerDiagram.cd
- Properties
- Searcharoo.csproj
- SearchEngineDiagram.cd
- SpiderDiagram.cd
- WebApplication
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Searcharoo.Common
{
public abstract class DownloadDocument : Document
{
public DownloadDocument(Uri location)
: base(location)
{}
protected void SaveDownloadedFile(System.Net.HttpWebResponse webresponse, string filename)
{
System.IO.Stream filestream = webresponse.GetResponseStream();
this.Uri = webresponse.ResponseUri;
using (System.IO.BinaryReader reader = new System.IO.BinaryReader(filestream))
{
using (System.IO.FileStream iofilestream = new System.IO.FileStream(filename, System.IO.FileMode.Create))
{
int BUFFER_SIZE = 1024;
byte[] buf = new byte[BUFFER_SIZE];
int n = reader.Read(buf, 0, BUFFER_SIZE);
while (n > 0)
{
iofilestream.Write(buf, 0, n);
n = reader.Read(buf, 0, BUFFER_SIZE);
}
this.Uri = webresponse.ResponseUri;
this.Length = iofilestream.Length;
iofilestream.Close();
iofilestream.Dispose();
}
reader.Close();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.