//============================================================================ //============================================================================ private void processCompleted(object sender, EventArgs e) { mProcessCaller = null; if (!mBatchProcess && batchFileTextBox.Text != @"") { log("Executing " + batchFileTextBox.Text + "..."); mBatchProcess = true; mProcessCaller = new ProcessCaller(this); mProcessCaller.FileName = batchFileTextBox.Text; mProcessCaller.Arguments = @""; mProcessCaller.StdErrReceived += new DataReceivedHandler(writeProcessOutput); mProcessCaller.StdOutReceived += new DataReceivedHandler(writeProcessOutput); mProcessCaller.Completed += new EventHandler(processCompleted); mProcessCaller.Cancelled += new EventHandler(processCanceled); //mProcessCaller.Failed += no event handler for this one, yet. mProcessCaller.Start(); return; } goButton.Enabled = true; cancelButton.Enabled = false; this.Cursor = Cursors.Default; writeOptions(); log("Completed"); }
//============================================================================ //============================================================================ private void doGetBuild() { if (mProcessCaller != null) { return; } //logList.Items.Clear(); if (logList.Items.Count > 0) { log(""); } if (buildListView.Items.Count == 0 || buildListView.SelectedIndices.Count == 0) { log("ERROR: No build selected."); return; } // Get the path to 7z.exe and make sure it exists string zipPath = zipFolderTextBox.Text; if (zipPath.Length > 0) { string c = zipPath.Substring(zipPath.Length - 1); if (c != @"\\") { zipPath += @"\"; } } bool zipExists = false; try { zipExists = File.Exists(zipPath + "7z.exe"); } catch { } if (!zipExists) { log("ERROR: Can't find 7-Zip program."); return; } // Setup path to the build archive string buildFile = (String)mBuildFiles[buildListView.SelectedIndices[0]]; if (buildFile == null) { log("ERROR: No build file selected."); return; } string buildPath = buildFolderTextBox.Text; if (buildPath.Length > 0) { string c = buildPath.Substring(buildPath.Length - 1); if (c != @"\\") { buildPath += @"\"; } } // Setup the local path string localPath = localFolderTextBox.Text; if (localPath.Length == 0) { log("ERROR: No local folder specified."); return; } else { string c = localPath.Substring(localPath.Length - 1); if (c != @"\\") { localPath += @"\"; } } goButton.Enabled = false; cancelButton.Enabled = true; this.Cursor = Cursors.AppStarting; log("Getting build " + buildFile + "..."); lastBuildTextBox.Text = buildFile; // Clear out the local folder if (deleteFilesCheckBox.Checked) { deleteLocalFiles(localPath); } // Run 7z to decompress the build mBatchProcess = false; mProcessCaller = new ProcessCaller(this); mProcessCaller.FileName = zipPath + @"7z.exe"; mProcessCaller.Arguments = @"x " + buildPath + buildFile + @" -y -o" + localPath; mProcessCaller.StdErrReceived += new DataReceivedHandler(writeProcessOutput); mProcessCaller.StdOutReceived += new DataReceivedHandler(writeProcessOutput); mProcessCaller.Completed += new EventHandler(processCompleted); mProcessCaller.Cancelled += new EventHandler(processCanceled); //mProcessCaller.Failed += no event handler for this one, yet. mProcessCaller.Start(); //mProcess = new Process(); //mProcess.StartInfo.FileName = zipPath + @"7z.exe"; //mProcess.StartInfo.Arguments = @"x " + buildPath + buildFile + @" -y -o" + localPath; //mProcess.StartInfo.UseShellExecute = false; //mProcess.Start(); }