public void ExecuteThreadedWork() { DownloadFile download = new DownloadFile(DownloadUrl, LocalPath); byte[] fileBytes = download.DownloadHttp(); if (fileBytes == null || fileBytes.Length <= 0) { Loom.DispatchToMainThread(() => { NotiData data = new NotiData(NotiConst.UPDATE_FAILED, this.FileName, LanguageTips.UPDATE_FAILED); if (OnComplete != null) { OnComplete(data); //回调逻辑层 } //MessageBox.DisplayMessageBox(string.Format("{0}: {1}", UpdateTips.UPDATE_FAILED, FileName), 0, (go) => //{ // AssetsCtrl.downloadFailed = true; //}); }); return; } string path = Path.GetDirectoryName(LocalPath); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (LocalPath.CustomEndsWith(".ab")) { BeginDecompressExtract(LocalPath, fileBytes); } else { DownloadFileMD5 = MD5.ComputeHashString(fileBytes); if (DownloadFileMD5 != SrcMD5) { throw new Exception(LanguageTips.UPDATE_MD5_ERROR); } if (File.Exists(LocalPath)) { File.Delete(LocalPath); } File.WriteAllBytes(LocalPath, fileBytes); } }