public override void SetDownloaderFromBreakpoint(DownloaderMessage Message) { if (State != DownloadState.Uninitialized) { return; } this.Message = Message; State = DownloadState.Prepared; }
public override void SetDownloaderFromBreakpoint(DownloaderMessage mes) { if (State != DownloadState.Uninitialized) { return; } //触发事件指示控件加载已完成 Message = mes; speedHelper.CurrentValue = mes.DownloadSize; State = DownloadState.Prepared; }
public override void SetDownloader(DownloaderSettings settings) { if (State != DownloadState.Uninitialized) { return; } Message = new DownloaderMessage(); Message.DownloaderType = Type; Message.DownloadSize = 0; Message.FileName = Path.GetFileNameWithoutExtension(settings.FileName); Message.Extention = Path.GetExtension(settings.FileName); Message.FileSize = null; Message.TempFilePath = Path.Combine( Windows.Storage.ApplicationData.Current.LocalCacheFolder.Path, StorageTools.StorageManager.GetTemporaryName() + settings.FileName); Message.URL = settings.Url; State = DownloadState.Prepared; return; }
public override void SetDownloader(DownloaderSettings settings) { if (State != DownloadState.Uninitialized) { return; } try { Message = new DownloaderMessage(); Message.DownloaderType = Type; //设置文件信息 Message.FileSize = settings.Size; Message.URL = settings.Url; Message.FileName = Path.GetFileNameWithoutExtension(settings.FileName); Message.Extention = Path.GetExtension(settings.FileName); //安排线程 Message.Threads.ArrangeThreads((long)Message.FileSize, settings.Threads <= 0 ? StorageTools.Settings.ThreadNumber : ((int)settings.Threads)); //申请临时文件 Message.TempFilePath = settings.FilePath; State = DownloadState.Prepared; } catch (Exception e) { HandleError(e, CurrentOperationCode); } }
/// <summary> /// 使用Message从断点恢复下载器 /// </summary> public abstract void SetDownloaderFromBreakpoint(DownloaderMessage message);