public void AddItem(string Path) { ArchiveEntry entry = new ArchiveEntry(Path, null, false, EncryptionType.None); if (m_Archive.add(entry)) { AddFile(entry.getNameExtension(), entry.getExtension(), entry.getSizeData(), entry.getId(), Path); SetSavedState(false); SetStatus(String.Format("Added {0} to the archive.", entry.getNameExtension())); } else { ReplaceFile(entry.getNameExtension(), entry.getExtension(), entry.getSizeData(), entry.getId(), Path); SetSavedState(false); SetStatus(String.Format("Replaced {0} in the archive.", entry.getNameExtension())); } }
private void lvFiles_ItemDrag(object sender, ItemDragEventArgs e) { List <string> selection = new List <string>(); foreach (ListViewItem item in lvFiles.SelectedItems) { ArchiveEntry ent = m_Archive.getByName(Path.GetFileNameWithoutExtension(item.Text)); if (ent == null) { return; } ent.extractTo(Path.GetTempPath()); string file = String.Format("{0}\\{1}{2}", Path.GetTempPath(), ent.getName(), ent.getExtension()); selection.Add(file); } DataObject data = new DataObject(DataFormats.FileDrop, selection.ToArray()); DoDragDrop(data, DragDropEffects.Move); }
private void menuItemView_Click(object sender, EventArgs e) { if (!isLoaded()) { return; } if (lvFiles.SelectedItems.Count == 0) { return; } ArchiveEntry ent = m_Archive.getByName(Path.GetFileNameWithoutExtension(lvFiles.SelectedItems[0].Text)); if (ent == null) { return; } ent.extractTo(Path.GetTempPath()); string file = String.Format("{0}\\{1}{2}", Path.GetTempPath(), ent.getName(), ent.getExtension()); Process p = Process.Start(file); if (p != null) { p.WaitForExit(); } File.Delete(file); }