public static ShellFileGroup FromClipboard(System.Windows.Forms.IDataObject FromDataObject) { ShellFileGroup _group = new ShellFileGroup(); System.Runtime.InteropServices.ComTypes.IDataObject DataObject = (System.Runtime.InteropServices.ComTypes.IDataObject)FromDataObject; if (DataObject != null) { NativeMethods.FILEDESCRIPTOR[] _files = NativeMethods.GetFileDescriptors(DataObject, out _group._hGlobal); for (int _f = 0; _f < _files.Length; _f++) { _group.Add(_files[_f].cFileName, NativeMethods.GetFileContents(DataObject, _f, _files[_f].nFileSizeLow)); } GlobalUnlock(_group._hGlobal); _group._hGlobal = IntPtr.Zero; } return(_group); }
public static ShellFileGroup FromClipboard(System.Windows.Forms.IDataObject FromDataObject) { ShellFileGroup _group = new ShellFileGroup(); System.Runtime.InteropServices.ComTypes.IDataObject DataObject = (System.Runtime.InteropServices.ComTypes.IDataObject)FromDataObject; if (DataObject != null) { NativeMethods.FILEDESCRIPTOR[] _files = NativeMethods.GetFileDescriptors(DataObject, out _group._hGlobal); for (int _f = 0; _f < _files.Length; _f++) { _group.Add(_files[_f].cFileName, NativeMethods.GetFileContents(DataObject, _f, _files[_f].nFileSizeLow)); } GlobalUnlock(_group._hGlobal); _group._hGlobal = IntPtr.Zero; } return _group; }
private void cutToolStripMenuItem_Click(object sender, EventArgs e) { if ((CurrentArchive != null) && (listView1.SelectedItems.Count > 0) && NotInDebugger()) { ReleaseCutItems(); ShellFileGroup _files = new ShellFileGroup(); ItemsCutToClipboard = new ListViewItem[listView1.SelectedItems.Count]; listView1.SelectedItems.CopyTo(ItemsCutToClipboard, 0); foreach (ListViewItem _item in ItemsCutToClipboard) { EQArchiveFile _file = (EQArchiveFile)_item.Tag; _files.Add(_file.Filename, _file.GetContents()); _item.ForeColor = SystemColors.GrayText; } _files.ActionCompleted += clipboardOperation_Complete; Clipboard.SetDataObject(_files.GetDataObject(DragDropEffects.Move)); CheckClipboard(); } }
private void copyToolStripMenuItem_Click(object sender, EventArgs e) { if ((CurrentArchive != null) && (listView1.SelectedItems.Count > 0) && NotInDebugger()) { ReleaseCutItems(); ShellFileGroup _files = new ShellFileGroup(); foreach (ListViewItem _item in listView1.SelectedItems) { EQArchiveFile _file = (EQArchiveFile)_item.Tag; _files.Add(_file.Filename, _file.GetContents()); } Clipboard.SetDataObject(_files.GetDataObject(DragDropEffects.Copy)); CheckClipboard(); } }
private void clipboardOperation_Complete(ShellFileGroup FileGroup, DragDropEffects Effect) { if (Effect == DragDropEffects.Move) { foreach (string _filename in FileGroup.Filenames) { // Successfully cut file and pasted it somewhere DeleteItem(listView1.Items[_filename.ToLower()]); } Status_Changed(); } }
private void listView1_ItemDrag(object sender, ItemDragEventArgs e) { if (NotInDebugger()) { ShellFileGroup _files = new ShellFileGroup(); foreach (ListViewItem _item in listView1.SelectedItems) { EQArchiveFile _file = ((EQArchiveFile)_item.Tag).AsFormat(Settings.ExportFormat, true); _files.Add(_file.Filename, _file.GetContents()); } listView1.DoDragDrop(_files.GetDataObject(DragDropEffects.Copy), DragDropEffects.Copy); } }
private int ImportFiles(ShellFileGroup ShellFiles) { int _numImported = 0; ArchiveLoading = true; if (ShellFiles != null) { if ((ShellFiles.Files.Count == 1) && Util.IsArchive(ShellFiles.Files[0].Name)) { if (File.Exists(ShellFiles.Files[0].Name)) { LoadArchive(ShellFiles.Files[0].Name); return 0; } } foreach (ShellFileGroup.ShellFile _file in ShellFiles.Files) { if (ImportFile(_file.Name, _file.Contents)) { _numImported++; } } } ArchiveLoading = false; if (_numImported > 0) { Status_Changed(true); } return _numImported; }