internal static void Zip(string spatialCommand, string zipAbsolutePath, string basePath, string subFolder, string filePattern, PlayerCompression useCompression) { var zipFileFullPath = Path.GetFullPath(zipAbsolutePath); var startInfo = new ProcessStartInfo { UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, FileName = spatialCommand, Arguments = ZipArgs(basePath, subFolder, filePattern, zipFileFullPath, useCompression), CreateNoWindow = true }; var zipProcess = SpatialRunner.RunCommandWithSpatialInThePath(spatialCommand, startInfo); var output = zipProcess.StandardOutput.ReadToEnd(); var errOut = zipProcess.StandardError.ReadToEnd(); zipProcess.WaitForExit(); if (zipProcess.ExitCode != 0) { throw new Exception(string.Format("Could not package the folder {0}/{1}. The following error occurred: {2}, {3}\n", basePath, subFolder, output, errOut)); } }
/// <summary> /// Starts a process and ensures that fullPathToSpatial is available in the PATH environment variable. /// </summary> public static Process RunCommandWithSpatialInThePath(string fullPathToSpatial, ProcessStartInfo startInfo) { return(SpatialRunner.RunCommandWithSpatialInThePath(fullPathToSpatial, startInfo)); }
/// <summary> /// Temporary solution for running external processes. /// </summary> public static void RunPausedProcess(string command, string arguments, string workingDir) { SpatialRunner.RunPausedProcess(command, arguments, workingDir); }