/// <summary> /// 组合打包文件 /// </summary> /// <returns></returns> private IEnumerator PitchFile() { this.m_updatPhase = UpdatePhase.PitchFile; string fileName = "Temp/" + KTConfigs.kSrcName; string deltaName = "Temp/" + KTConfigs.kDeltaName; Debug.Log("组合补丁文件"); Directory.SetCurrentDirectory(KTPathHelper.DataPath); OctodiffUtil.ExecutePitch(fileName, deltaName, KTConfigs.kSrcName); //把新的src.zip文件拷贝到persistentDataPath/Temp目录下,覆盖掉原来的src.zip if (File.Exists(fileName)) { File.Delete(fileName); } if (File.Exists(KTConfigs.kSrcName)) { File.Move(KTConfigs.kSrcName, fileName); } //删掉除Temp目录之外的所有旧资源,目录直接删掉,文件不需要删,会直接覆盖 Directory.Delete(KTPathHelper.DataPath + "BuildRes", true); Directory.Delete(KTPathHelper.DataPath + "lua", true); Directory.SetCurrentDirectory(Application.dataPath.Replace("/Assets", "")); Debug.Log("解压src.zip"); this.m_updatPhase = UpdatePhase.UnZipFile; ZipTool.unZipFile(KTPathHelper.DataPath + fileName, KTPathHelper.DataPath);//需要时间 yield return(UpdateComplete()); }
public static void PitchDeltaFile() { Object obj = Selection.activeObject; if (obj == null) { return; } string oldSrcName = Path.Combine("OldVersion", KTConfigs.kSrcName); string deltaName = Path.Combine("NewVersion", KTConfigs.kDeltaName); string newSrcName = Path.Combine(AssetDatabase.GetAssetPath(obj), KTConfigs.kSrcName); Directory.SetCurrentDirectory(Application.dataPath); OctodiffUtil.ExecutePitch(oldSrcName, deltaName, newSrcName); Directory.SetCurrentDirectory(Application.dataPath.Replace("/Assets", "")); AssetDatabase.Refresh(); }
public static void CreateDeltaFile() { string oldSrcName = Path.Combine("OldVersion", KTConfigs.kSrcName); string octosigName = Path.Combine("NewVersion", KTConfigs.kSigName); string newSrcName = Path.Combine("NewVersion", KTConfigs.kSrcName); string deltaName = Path.Combine("NewVersion", KTConfigs.kDeltaName); if (!File.Exists(oldSrcName) || !File.Exists(newSrcName)) { UnityEngine.Debug.LogError(oldSrcName + " or" + newSrcName + " not exist"); return; } Directory.SetCurrentDirectory(Application.dataPath); OctodiffUtil.ExecuteSignature(oldSrcName, octosigName); OctodiffUtil.ExecuteDelta(octosigName, newSrcName, deltaName); Directory.SetCurrentDirectory(Application.dataPath.Replace("/Assets", "")); AssetDatabase.Refresh(); }