private void DrawBuildGUI() { selectedViewer = viewerBuildsGUI.CurrentPack; showViewerSelecting = EditorGUILayout.Foldout(showViewerSelecting, $"Viewer: {selectedViewer?.Version ?? "NOT SELECTED"}"); if (showViewerSelecting) { EditorGUI.indentLevel++; viewerBuildsGUI.Draw(); EditorGUI.indentLevel--; } selectedDesktopClient = desktopClientBuildsGUI.CurrentPack; showDesktopClientSelecting = EditorGUILayout.Foldout(showDesktopClientSelecting, $"Desktop client: {selectedDesktopClient?.Version ?? "NOT SELECTED"}"); if (showDesktopClientSelecting) { EditorGUI.indentLevel++; desktopClientBuildsGUI.Draw(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); EditorGUILayout.LabelField("Exporting excursion", EditorStyles.boldLabel); DrawExportingSection(); EditorGUILayout.Space(); DrawExportButton(selectedViewer, selectedDesktopClient); }
public static void UnpackViewer(WebViewerBuildPack viewer, string folderPath) { using (var fileStream = File.OpenRead(viewer.ArchiveLocation)) using (var zipInputStream = new ZipInputStream(fileStream)) { while (zipInputStream.GetNextEntry() is ZipEntry zipEntry) { var entryFileName = zipEntry.Name; var buffer = new byte[4096]; var fullZipToPath = Path.Combine(folderPath, entryFileName); var directoryName = Path.GetDirectoryName(fullZipToPath); if (!string.IsNullOrEmpty(directoryName)) Directory.CreateDirectory(directoryName); if (Path.GetFileName(fullZipToPath).Length == 0) { continue; } using (FileStream streamWriter = File.Create(fullZipToPath)) { StreamUtils.Copy(zipInputStream, streamWriter, buffer); } } } }
public ExportOptions( WebViewerBuildPack viewerPack, DesktopClientBuildPack desktopClientBuildPack, string folderPath, int imageCroppingLevel) : base(ResourceHandlePath.CopyToDist, imageCroppingLevel) { FolderPath = folderPath; ViewerPack = viewerPack; DesktopClientBuildPack = desktopClientBuildPack; }
private void DrawExportButton(WebViewerBuildPack selectedViewer, DesktopClientBuildPack selectedDesktopClient) { if (GUILayout.Button("Export")) { if (selectedViewer == null || selectedDesktopClient == null) { EditorUtility.DisplayDialog("Error", $"Please, select viewer and desktop client versions", "Ok"); return; } if (!TourExporter.TryGetTargetFolder(outFolderPath)) { return; } TourExporter.ExportTour(new TourExporter.ExportOptions(selectedViewer, selectedDesktopClient, outFolderPath, imageCroppingLevel)); } }
public static void BuildLivePreviewBackend( string projectFolder, string outputFolder, WebViewerBuildPack selectedBuildPack) { try { var systemRuntime = GetSystemRuntime(); var arguments = $"publish {projectFolder} " + $"-r {systemRuntime} " + $"-o {outputFolder} " + $"-c Release " + $"--self-contained true " + $"-p:PublishSingleFile=true " + $"-p:PublishTrimmed=true" + $"-p:DebugType=None" + $"-p:DebugSymbols=False"; var proc = Process.Start(new ProcessStartInfo { FileName = "dotnet", Arguments = arguments, UseShellExecute = true, RedirectStandardOutput = false }); proc.WaitForExit(); if (proc.ExitCode != 0) { throw new Exception("Can't build live preview"); } TourExporter.UnpackViewer(selectedBuildPack, Path.Combine(outputFolder, "wwwroot")); } catch (Exception ex) { Debug.LogError(ex.Message); throw; } }
private void OnGUI() { if (previewBackendProcess != null) { DrawRunnedProcess(); return; } if (!isDotNetInstalled) { DrawInstallDotNetMessage(); return; } viewerBuildsGUI.Draw(); selectedBuildPack = viewerBuildsGUI.CurrentPack; if (!File.Exists(GetExecutablePath())) { DrawBuildPreviewBackend(); return; } DrawReadyToStart(); }