public AbstractDownload(Uri url, int bufferSize, long?offset, long?maxReadBytes, ISDRequestBuilder requestBuilder, ISDChecker downloadChecker) { if (url == null) { throw new ArgumentNullException("url"); } if (bufferSize < 0) { throw new ArgumentException("bufferSize < 0"); } if (offset.HasValue && offset.Value < 0) { throw new ArgumentException("offset < 0"); } if (maxReadBytes.HasValue && maxReadBytes.Value < 0) { throw new ArgumentException("maxReadBytes < 0"); } this.url = url; this.bufferSize = bufferSize; this.offset = offset; this.maxReadBytes = maxReadBytes; this.requestBuilder = requestBuilder; this.downloadChecker = downloadChecker; this.state = SDState.Initialized; }
public virtual void Start() { lock (this.monitor) { if (this.state != SDState.Initialized) { throw new InvalidOperationException("Invalid state: " + this.state); } this.state = SDState.Running; } this.OnStart(); }