void addItem(CompressionItem newItem, bool add) { if (newItem.Target.StartsWith(@"\\", StringComparison.InvariantCulture)) { // "Network places are not allowed to be added to the list of backup items!" MessageBox.Show(Translation.Current[454], String.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0); return; } if (add) { _items.Add(newItem); } _listView.BeginUpdate(); ListViewItem newlistViewItem = new ListViewItem(newItem.Target); if (newItem.IsFolder) { newlistViewItem.ImageIndex = 0; } else { newlistViewItem.ImageIndex = 1; } newlistViewItem.Group = _listView.Groups[(int)newItem.CompressionDegree]; _listView.Items.Add(newlistViewItem); _listView.EndUpdate(); }
void addFoldersToTheBackupItemsList() { while (ofd.ShowDialog() == DialogResult.OK) { CompressionItem folder = new CompressionItem(ofd.SelectedPath, true, CompressionDegree.Normal); _itemsToBackup.VerifyNewItem(folder); } }
public ArchiveTask(ProcessPriorityClass priority, string resultArchive, CompressionItem item, string password) { if (item == null) { throw new ArgumentNullException("item"); } _priority = priority; _archiveName = resultArchive; _compressionItem = item; сreateArgumentsForCompressionWithPassword(password); }
void compressionItemsListViewDragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop, false)) { string[] newitems = (string[])e.Data.GetData(DataFormats.FileDrop); CompressionItem[] files = new CompressionItem[newitems.Length]; for (int i = 0; i < newitems.Length; i++) { files[i] = new CompressionItem(newitems[i], Directory.Exists(newitems[i]), CompressionDegree.Normal); } _itemsToBackup.VerifyNewItems(files); } }
void addFilesToTheBackupItemsList() { while (openFileDialog.ShowDialog() == DialogResult.OK) { CompressionItem[] files = new CompressionItem[openFileDialog.FileNames.Length]; for (int i = 0; i < files.Length; i++) { files[i] = new CompressionItem(openFileDialog.FileNames[i], false, CompressionDegree.Normal); } _itemsToBackup.VerifyNewItems(files); } }
public void VerifyNewItem(CompressionItem newItem) { VerifyNewItems(new CompressionItem[] { newItem }); }
public PackingNotificationEventArgs(CompressionItem item, ProcessingState state) : base() { _item = item; _state = state; }