private void AddDownloadObserve() { DownloadObseve downloadObseve = new DownloadObseve(); downloadObseve.Failure += new DownloadObseve.FailureHandler(this.FailureEvent); downloadObseve.Loading += new DownloadObseve.LoadingHandler(this.DownloadingEvent); downloadObseve.Success += new DownloadObseve.SuccessHandler(this.SuccessEvent); downloadObseve.CanWrite += new DownloadObseve.CanWriteHandler(this.CanWriteMemoryStreamEvent); downloadObseve.SetRetryNumber(this._retryNumber); downloadObseve.StartDownload(this._requestUrlList.First.Value, this._coroutineExecuter, this._uriAction(this._prefix, this._requestUrlList.First.Value)); downloadObseve.CompressedSize = this._itemCompressedSize[this._requestUrlList.First.Value]; this._downloadObserveList.Add(downloadObseve); this._requestUrlList.RemoveFirst(); }
private void SuccessEvent(DownloadObseve observe, string identificationKey, byte[] bytes, int size, double downloadTime) { if (!this.IsFailured && !this.IsAborting) { this._downloadedAction(identificationKey, bytes, size, downloadTime); if (5242880 < size) { this.IsWait = true; } if (this._downloadObserveList.Contains(observe)) { this._downloadObserveList.Remove(observe); } } if (observe != null) { observe.Dispose(); } observe = (DownloadObseve)null; }