private void DownloadNextItem() { _currentIndex++; if (_currentIndex >= FileUpdateInfos.Count) { CheckFiles(); ProcessPostDownload(); return; } var fileUpdateInfo = FileUpdateInfos[_currentIndex]; if (NeedUpdate(fileUpdateInfo)) { if (!_hasDisplayedMessage) { _hasDisplayedMessage = true; _toastService.CloseMessages(L("Loading")); _toastService.ShowInformation(L("UpdateFullText") + Environment.NewLine + L("HotsBpHelper")); } try { Logger.Trace("Downloading file: {0}", fileUpdateInfo.FileName); //防盗链算法 var T = ((int)DateTime.Now.AddMinutes(1).ToUnixTimestamp()).ToString("x8").ToLower(); var S = SecurityProvider.UrlKey + HttpUtility.UrlEncode(fileUpdateInfo.Path).Replace("%2f", "/") + T; string SIGN = string.Empty; try { SIGN = GetSwcMD5(S).ToLower(); } catch (Exception) { #pragma warning disable 618 SIGN = FormsAuthentication.HashPasswordForStoringInConfigFile(S, "MD5").ToLower(); #pragma warning restore 618 } _restApi.DownloadFileAsync(fileUpdateInfo.Url + "?sign=" + SIGN + "&t=" + T, DownloadProgressChanged, DownloadFileCompleted); } catch (Exception e) { fileUpdateInfo.FileStatus = L("UpdateFailed") + e.Message; Logger.Error(e, "Downloading error."); } } else { fileUpdateInfo.FileStatus = L("UpToDate"); // ReSharper disable once TailRecursiveCall DownloadNextItem(); } }