BExplorer.Shell.ShellView.PasteAvailableFiles C# (CSharp) Method

PasteAvailableFiles() public method

public PasteAvailableFiles ( ) : void
return void
    public void PasteAvailableFiles() {
      var handle = this.Handle;
      var view = this;
      var thread = new Thread(() => {
        var dataObject = F.Clipboard.GetDataObject();
        var dropEffect = dataObject.ToDropEffect();
        if (dataObject != null && dataObject.GetDataPresent("Shell IDList Array")) {
          var shellItemArray = dataObject.ToShellItemArray();
          var items = shellItemArray.ToArray();

          try {
            var sink = new FOperationProgressSink(view);
            var controlItem = FileSystemListItem.InitializeWithIShellItem(this.LVHandle, items.First()).Parent;
            var fo = new IIFileOperation(sink, handle, true, controlItem.Equals(this.CurrentFolder));
            if (dropEffect == System.Windows.DragDropEffects.Copy) {
              fo.CopyItems(shellItemArray, this.CurrentFolder);
            } else {
              fo.MoveItems(shellItemArray, this.CurrentFolder);
            }

            fo.PerformOperations();
            Marshal.ReleaseComObject(shellItemArray);
          } catch (SecurityException) {
            throw;
          }
        } else if (dataObject != null && dataObject.GetDataPresent("FileDrop")) {
          var items = ((String[])dataObject.GetData("FileDrop")).Select(s => ShellItem.ToShellParsingName(s).ComInterface).ToArray();
          try {
            var sink = new FOperationProgressSink(view);
            var controlItem = FileSystemListItem.InitializeWithIShellItem(this.LVHandle, items.First()).Parent;
            var fo = new IIFileOperation(sink, handle, true, controlItem.Equals(this.CurrentFolder));
            foreach (var item in items) {
              if (dropEffect == System.Windows.DragDropEffects.Copy)
                fo.CopyItem(item, this.CurrentFolder);
              else
                fo.MoveItem(item, this.CurrentFolder, null);
            }

            fo.PerformOperations();
          } catch (SecurityException) {
            throw;
          }
        }
        this.LargeImageList.SupressThumbnailGeneration(false);
      });

      thread.SetApartmentState(ApartmentState.STA);
      thread.Start();
      Shell32.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
    }
ShellView