public void DeleteItem(string source)
 {
     ThrowIfDisposed();
     using (ComReleaser <IShellItem> sourceItem = CreateShellItem(source)) {
         _fileOperation.DeleteItem(sourceItem.Item, null);
     }
 }
Esempio n. 2
0
        public static void Delete(string filename)
        {
            var fileItem = CreateItem(filename);
            var result   = _fileOperation.DeleteItem(fileItem, IntPtr.Zero);

            Marshal.ReleaseComObject(fileItem);
            AssertHresult(result);
        }
        //public HResult CopyItems(object punkItems, IShellItem psiDestinationFolder) => throw new NotImplementedException();

        public void DeleteItem(IShellItem psiItem, FileOperationProgressSink pfopsItem)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(nameof(FileOperation));
            }

            HResult hr = fileOperation.DeleteItem(psiItem, pfopsItem?.FileOperationProgressSinkInternal);

            if (!CoreErrorHelper.Succeeded(hr))
            {
                Marshal.ThrowExceptionForHR((int)hr);
            }
        }
 public void DeleteItem(string source)
 {
     ThrowIfDisposed();
     using var sourceItem = CreateShellItem(source);
     _fileOperation.DeleteItem(sourceItem.Item, null);
 }
Esempio n. 5
0
        public void DeleteItem(string source)
        {
            IShellItem sourceItem = SafeNativeMethods.CreateShellItem(source);

            fileOperation.DeleteItem(sourceItem, null);
        }