/// <summary> /// Main Download method /// </summary> /// <param name="fileName"></param> /// <param name="fileNameIndex"></param> /// <param name="totalCount"></param> /// <param name="AUTO_DECRYPT"></param> /// <returns></returns> private async Task DownloadFiles(string fileName, int fileNameIndex, int totalCount, AUTO_DECRYPT AUTO_DECRYPT) { SetNoticesText("正在下载 ... " + _downloadDoneList.Count + " / " + totalCount, downloadNotice); if (IsSeveralFiles) { _downloadProcessMessageHandler.HttpReceiveProgress += (senders, es) => { var num = es.ProgressPercentage; SetProgressInt(num); } } ; _downloadDoneList.Add(await _request.MakeGetRequest(Define.GetUrl(fileName), Define.GetFileSavePath(), fileName)); SetNoticesText("正在下载 ... " + _downloadDoneList.Count + " / " + totalCount, downloadNotice); if (!IsSeveralFiles) { ReloadProcess(totalCount); } if (AUTO_DECRYPT == AUTO_DECRYPT.Auto) { if (Save.GetFileType(fileName) != ENC_TYPE.ERROR) { DecryptFiles.DecryptFile(Define.GetFileSavePath() + fileName, Crypt.Crypt.IdentifyEncVersion(fileName)); } } OnDownloadDone(totalCount); }
public async void SaveFile(int id, string savePath) { if (await _makeRequest.MakeSingleGetRequest(GetUrl(id), savePath, GetFileNme(id)) != null) { DecryptFiles.DecryptFile(savePath + GetFileNme(id), Crypt.EncVersion.Ver2); } }