public void StopDownLoad() { var itr = httpDownloadAsyncs.GetEnumerator(); while (itr.MoveNext()) { itr.Current.StopDownLoad(); } itr.Dispose(); FileManifestManager.WriteABDataByCurrent(); FileManifestManager.WriteFenBaoDataByCurrent(); }
// 开始解压缩 public void StartDecompress() { UpdateStageResult.DownLoad.IsEnable = false; UpdateStageResult.Compression.IsEnable = true; UpdateStageResult.Compression.ClearAll(); var deItr = _decompress_queue.GetEnumerator(); while (deItr.MoveNext()) { UpdateStageResult.Compression.TotalSize += deItr.Current.TotalSize; UpdateStageResult.Compression.FileCount++; } deItr.Dispose(); string localPath = AssetsCommon.LocalAssetPath; if (!Directory.Exists(localPath)) { Directory.CreateDirectory(localPath); } AssetDownInfo[] tempDatas = new AssetDownInfo[_decompress_queue.Count]; for (int i = 0; i < tempDatas.Length; i++) { int index = _decompress_queue[i].Index; tempDatas[index] = _decompress_queue[i]; } for (int i = 0; i < tempDatas.Length; i++) { AssetDownInfo downInfo = tempDatas[i]; string zipFileName = string.Format("{0}/{1}", localPath, downInfo.AssetName); List <AssetDataInfo> assetNames = ZipHelper.Decompress( zipFileName, localPath); AssetDataInfo dataInfo = downInfo.ToAssetDataInfo(); dataInfo.IsCompressed = true; UpdateStageResult.Compression.CurrentCount++; FileManifestManager.UpdateLocalFenBaoData(dataInfo); for (int j = 0; j < assetNames.Count; j++) { FileManifestManager.UpdateLocalABData(assetNames[j]); } if (File.Exists(zipFileName)) { File.Delete(zipFileName); } } UpdateStageResult.Compression.IsEnable = false; if (_owner.IsDownLoadAllVersion) { FileManifestManager.WriteFenBaoDataByServer(); } else { FileManifestManager.WriteFenBaoDataByCurrent(); } FileManifestManager.WriteABDataByCurrent(); }