void BuildiOS() { var oldTarget = EditorUserBuildSettings.activeBuildTarget; DirectoryEx.CreateDirectory(OutputDir); var app = BuildPlayer(GetIOSBuildTarget(), BuildOptions.None, "Assets/Level1.unity"); var appDataDir = Path.Combine(app, "Data"); var assetbundle = BuildStreamedSceneAssetBundle(GetIOSBuildTarget(), "Assets/Level2.unity"); if (!AssetBundlePatch.IsSupport(assetbundle)) { Debug.LogError("AssetBundlePatch.IsSupport failed!!!!"); return; } EditorUserBuildSettings.SwitchActiveBuildTarget(oldTarget); var diff = Path.Combine(OutputDir, Updater.Diff); var ret = AssetBundlePatch.Diff(appDataDir, null, assetbundle, diff); if (!ret) { Debug.LogError("AssetBundlePatch.Diff failed!!!!"); return; } // Real environment, you need to place this file on http server var diffZip = Path.Combine(appDataDir, "Raw"); diffZip = Path.Combine(diffZip, Updater.DiffZip); ZipFile.CreateFromDirectory(new string[] { diff }, diffZip); var sb = new StringBuilder(); sb.AppendLine(DateTime.Now.ToString()); sb.AppendLine(string.Format("Assetbundle size:{0}", GetFileSizeString(assetbundle))); sb.AppendLine(string.Format("Diff size:{0}", GetFileSizeString(diff))); sb.AppendLine(string.Format("Diff zip size:{0}", GetFileSizeString(diffZip))); DebugInfo = sb.ToString(); }
void ProcessNextEntry() { while (true) { var theEntry = ZipStream.GetNextEntry(); if (theEntry == null) { CurState = State.Succeed; return; } var fileName = Path.GetFileName(theEntry.Name); if (string.IsNullOrEmpty(fileName)) { continue; } string file = Path.Combine(DestinationDirectoryName, theEntry.Name); DirectoryEx.CreateDirectory(Directory.GetParent(file)); WriteFileStream = File.OpenWrite(file); return; } }