private void goButton_Click(object sender, EventArgs e) { string[] fileList = getFileList(); // are there entries in our file list? if (fileList.Length == 0) { MessageBox.Show( "Please add some files to be processed first", "No files in batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // check we've got an output directory if (!overwriteCheckBox.Checked && outputDirectoryTextBox.Text == String.Empty) { MessageBox.Show( "Please select an output directory to continue", "No output directory selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // check the output directory exists if (!overwriteCheckBox.Checked && !isValidOutputDirectory(outputDirectoryTextBox.Text)) { MessageBox.Show( "Output directory does not exist", "Invalid output directory", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // update output updateFileColsToNewFile(); // let's start the batch BatchOperations.BatchFileCompressor batch = new BatchOperations.BatchFileCompressor(); batch.OutputDirectory = outputDirectoryTextBox.Text; batch.OutputIfLarger = overwriteIfLargerCheckBox.Checked; batch.CompressionSettings = compressionSettings; batch.FilePaths = fileList; // if we're wanting to overwrite the original, set the output dir to null if (overwriteCheckBox.Checked) { batch.OutputDirectory = null; } // hook up to some events batch.FileProcessSuccess += new PNGoo.BatchOperations.FileProcessSuccessEventHandler(batch_FileProcessSuccess); batch.FileProcessFail += new PNGoo.BatchOperations.FileProcessFailEventHandler(batch_FileProcessFail); batch.Start(); }