private void extractButton_Click(object sender, EventArgs e) { folderBrowserDialog.Description = "Choose folder for unpacked files"; DialogResult FolderResult = folderBrowserDialog.ShowDialog(); // OK button was pressed. if (FolderResult == DialogResult.OK) { try { string folderName = folderBrowserDialog.SelectedPath; if (folderName.LastIndexOf('\\') != folderName.Length - 1) { folderName = folderName + "\\"; } // Extract files foreach (object itemChecked in fileList.CheckedItems) { FileItem item = (FileItem)itemChecked; item.DumpData(folderName); //FileStream subFile = new FileStream(folderName + item.FileName, FileMode.Create, FileAccess.Write); //if (subFile != null && subFile.CanWrite) //{ // item.DumpData(subFile); // subFile.Close(); //} //else //{ // MessageBox.Show(item.FileName + ": File is not writeable!?", "Error", MessageBoxButtons.OK); // return; //} } MessageBox.Show("All files are successfully extracted.", "Info", MessageBoxButtons.OK); } catch (Exception exp) { MessageBox.Show("An error occurred while attempting to load the file. The error is: " + System.Environment.NewLine + exp.ToString() + System.Environment.NewLine); } } }