public void Start(string filename) { try { _state = new DownloadState(); _state.Filestream = new FileStream(filename, FileMode.Append, FileAccess.Write, FileShare.Write); _received = _state.Filestream.Length; _request = WebRequest.Create(this.Url) as HttpWebRequest; _request.AddRange((int)_state.Filestream.Length); _timeout = new System.Threading.Timer(new TimerCallback(this.OnTimeout), _state, ResponseTimeout, System.Threading.Timeout.Infinite); _request.BeginGetResponse(new AsyncCallback(this.HttpResponseReceived), _state); } catch (Exception ex) { this.NotifyParentOfCompletion(false, ex); } }
public void Start() { try { _state = new DownloadState(); _request = WebRequest.Create(this.Url) as HttpWebRequest; _timeout = new System.Threading.Timer(new TimerCallback(this.OnTimeout), _state, ResponseTimeout, System.Threading.Timeout.Infinite); _request.BeginGetResponse(new AsyncCallback(this.HttpResponseReceived), _state); } catch (Exception ex) { this.NotifyParentOfCompletion(false, ex); } }