public static void DownloadChapterCache(int chapter, Action <string> onComplete = null, string tag = null) { _onComplete = onComplete; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.MainStoryIndex); if (!resIndex.packageDict.ContainsKey(chapter.ToString())) { FlowText.ShowMessage(I18NManager.Get("Download_ErrorChapter") + chapter); return; } DownloadManager.Clear(); ResPack resPack = resIndex.packageDict[chapter.ToString()]; _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; _downloadingWindow = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath); _downloadingWindow.Content = I18NManager.Get("Download_Downloading"); _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); var downItem = DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnComplete, OnError, OnProgress); _downloadingWindow.WindowActionCallback = evt => { if (evt == WindowEvent.Cancel) { downItem.Cancel(); } }; } }
public static void DownloadAllAudio(Action <string> onComplete = null, string tag = null) { _onComplete = onComplete; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.AllAudioIndex); ResPack resPack = resIndex.packageDict["AllAudio"]; _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; _downloadingWindow = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath); _downloadingWindow.Content = I18NManager.Get("Download_Downloading"); _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); var downItem = DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnComplete, OnError, OnProgressAll); _downloadingWindow.WindowActionCallback = evt => { if (evt == WindowEvent.Cancel) { downItem.Cancel(); } }; } }