void SetupBuildContainer(VisualElement container, string buildPath) { if (ShareUtils.BuildIsValid(buildPath)) { string gameTitle = buildPath.Split('/').Last(); SetupButton("btnOpenFolder", () => OnOpenBuildFolderClicked(buildPath), true, container, "Reveal Build Folder"); SetupButton("btnDelete", () => OnDeleteClicked(buildPath, gameTitle), true, container, "Delete Build"); SetupButton("btnShare", () => OnShareClicked(buildPath), true, container, "Publish WebGL Build to Unity Connect"); SetupLabel("lblLastBuildInfo", string.Format("Created: {0} with Unity {1}", File.GetLastWriteTime(buildPath), ShareUtils.GetUnityVersionOfBuild(buildPath)), container); SetupLabel("lblGameTitle", gameTitle, container); SetupLabel("lblBuildSize", string.Format("Build Size: {0}", ShareUtils.FormatBytes(ShareUtils.GetSizeFolderSize(buildPath))), container); container.style.display = DisplayStyle.Flex; return; } SetupButton("btnOpenFolder", null, false, container); SetupButton("btnDelete", null, false, container); SetupButton("btnShare", null, false, container); SetupLabel("lblGameTitle", "-", container); SetupLabel("lblLastBuildInfo", "-", container); container.style.display = DisplayStyle.None; }
private static bool Zip(Store <AppState> store, string buildOutputDir) { var projectDir = Directory.GetParent(Application.dataPath).FullName; var destPath = Path.Combine(projectDir, zipName); File.Delete(destPath); CopyThumbnail(buildOutputDir, store); ZipFile.CreateFromDirectory(buildOutputDir, destPath); FileInfo fileInfo = new FileInfo(destPath); if (fileInfo.Length > ZipFileLimitBytes) { store.Dispatch(new OnErrorAction { errorMsg = $"Max. allowed WebGL game .zip size is {ShareUtils.FormatBytes(ZipFileLimitBytes)}." }); return(false); } store.Dispatch(new ZipPathChangeAction { zipPath = destPath }); return(true); }