source: branches/eraser6/CodeReview/Eraser.Util/RecycleBin.cs @ 1563

Revision 1563, 1.9 KB checked in by lowjoel, 5 years ago (diff)

Replaced the ShellApi? class with the RecycleBin? class (since ShEmptyRecycleBin? was the only remaining member of the class) Addresses #284: Eraser.Util rewrite

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2009 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By: Garrett Trant <gtrant@users.sourceforge.net>
6 *
7 * This file is part of Eraser.
8 *
9 * Eraser is free software: you can redistribute it and/or modify it under the
10 * terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option) any later
12 * version.
13 *
14 * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 *
18 * A copy of the GNU General Public License can be found at
19 * <http://www.gnu.org/licenses/>.
20 */
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25
26namespace Eraser.Util
27{
28    public static class RecycleBin
29    {
30        /// <summary>
31        /// Empties the recycle bin for the current user.
32        /// </summary>
33        /// <param name="options">The list of flags to pass to the shell regarding
34        /// the user feedback, etc.</param>
35        public static void Empty(EmptyRecycleBinOptions options)
36        {
37            NativeMethods.SHEmptyRecycleBin(IntPtr.Zero, null,
38                (NativeMethods.SHEmptyRecycleBinFlags)options);
39        }
40    }
41
42    [Flags]
43    public enum EmptyRecycleBinOptions
44    {
45        /// <summary>
46        /// No flags specified.
47        /// </summary>
48        None = 0,
49
50        /// <summary>
51        /// No dialog box confirming the deletion of the objects will be displayed.
52        /// </summary>
53        NoConfirmation = (int)NativeMethods.SHEmptyRecycleBinFlags.SHERB_NOCONFIRMATION,
54
55        /// <summary>
56        /// No dialog box indicating the progress will be displayed.
57        /// </summary>
58        NoProgressUI = (int)NativeMethods.SHEmptyRecycleBinFlags.SHERB_NOPROGRESSUI,
59
60        /// <summary>
61        /// No sound will be played when the operation is complete.
62        /// </summary>
63        NoSound = (int)NativeMethods.SHEmptyRecycleBinFlags.SHERB_NOSOUND
64    }
65}
Note: See TracBrowser for help on using the repository browser.