void GenerateNewClient() { string newApk = Application.persistentDataPath + "/" + _targetVersion + "_game.apk"; string patchPath = Application.persistentDataPath + "/" + _targetVersion + "_" + _targetMd5 + ".patch"; if (!File.Exists(patchPath)) { _currentProgress.TotalSize = 50000; ChangeCurrentUpdateState(UpdateState.DownloadNewClient); return; } int res = AndroidInstallApk.GreateNewApk(newApk, patchPath); File.Delete(patchPath); if (res == 0) { if (FileHelper.GetFileMd5(newApk) == _targetMd5) { ChangeCurrentUpdateState(UpdateState.InstallNewClient); } else { if (File.Exists(newApk)) { File.Delete(newApk); } _onShowUpdateStepFail(100); } } else { if (File.Exists(newApk)) { File.Delete(newApk); } _onShowUpdateStepFail(res); } }
void InstallNewClient() { AndroidInstallApk.InstallApk(Application.persistentDataPath + "/" + _targetVersion + "_game.apk"); }