private void BtnExtractZip_Click(object sender, EventArgs e) { using (var zipform = new CompressForm()) { zipform.task = CompressForm.ZipTaskType.doUnZip; zipform.ArchiveFileName = CurrentArchive; zipform.ProjectName = Path.GetFileNameWithoutExtension(tp.ProjectFile); if (zipform.ShowDialog() == DialogResult.OK) { // reload the project file after extraction var oldDLUrl = tp.LinkPacketsDownloadURL; var oldFile = tp.ProjectFile; tp.LoadProjectFile(oldFile); LoadFromPacketTapPage(tp); tp.LinkPacketsDownloadURL = oldDLUrl; tPackedLogsURL.Text = oldDLUrl; ProjectInfo_TextChanged(null, null); MessageBox.Show("Done extracting " + zipform.ArchiveFileName, "Extract Archive", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (MessageBox.Show("Error extracting " + zipform.ArchiveFileName + "\r\nDo you want to open the file in another program instead ?", "Extract Archive", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { ExploreFile(zipform.ArchiveFileName); } } } }
private void BtnMake7zip_Click(object sender, EventArgs e) { using (var zipform = new CompressForm()) { zipform.task = CompressForm.ZipTaskType.doZip; string aName; if (tp.ProjectFile != string.Empty) { aName = Path.GetFileNameWithoutExtension(tp.ProjectFile) + ".7z"; } else { aName = Path.GetFileNameWithoutExtension(tp.ProjectFolder.TrimEnd(Path.DirectorySeparatorChar)) + ".7z"; } zipform.ArchiveFileName = Path.Combine(tp.ProjectFolder, aName); if (zipform.BuildArchieveFilesList(tProjectFolder.Text) <= 0) { MessageBox.Show("Nothing to add", "Make .7z", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (zipform.ShowDialog() == DialogResult.OK) { ProjectInfo_TextChanged(null, null); ExploreFile(zipform.ArchiveFileName); //MessageBox.Show("Done creating " + zipform.ArchiveFileName,"Make .7z",MessageBoxButtons.OK,MessageBoxIcon.Information); } else { try { if (File.Exists(zipform.ArchiveFileName)) { File.Delete(zipform.ArchiveFileName); } } catch { } MessageBox.Show("Error creating " + zipform.ArchiveFileName, "Make .7z", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }