public void DownLoadVersion(VersionItem ver, Main loader) { updateVersion = new UpdateVersion(); updateVersion.Version = ver.strVersion; updateVersion.VersionMax = ver.strVersionMax; updateVersion.File = new UpdateFile(); updateVersion.File.bHashChecked = false; updateVersion.File.Loadbytes = 0; updateVersion.File.strFile = ver.zip.fileName; if (File.Exists(ResMng.GetUpdateTmpPath() + "/" + ver.zip.fileName)) { File.Delete(ResMng.GetUpdateTmpPath() + "/" + ver.zip.fileName); } updateVersion.File.strLocalPath = ResMng.GetUpdateTmpPath() + "/" + ver.zip.fileName; updateVersion.File.Totalbytes = ver.zip.size; updateVersion.File.strMd5 = ver.zip.Md5; loader.StartDownLoad(updateVersion); }
void ExtractUPK(UpdateVersion zipInfo) { try { string localPak = ResMng.GetUpdateTmpPath() + "/" + Guid.NewGuid().ToString() + ".pak"; if (File.Exists(localPak)) { File.Delete(localPak); } LZMAHelper.DeCompressFile(zipInfo.File.strLocalPath, localPak); UPKExtra.ExtraUPK(localPak, ResMng.GetResPath()); AppInfo.SetAppVersion(zipInfo.VersionMax); UpdateHelper.CleanVersion(); GameStart(); } catch (Exception exp) { Log.WriteError(exp.Message + "|" + exp.StackTrace); } }