source: branches/eraser6/pluginsRewrite/Eraser.DefaultPlugins/ErasureTargets/FileErasureTarget.cs @ 2456

Revision 2456, 2.2 KB checked in by lowjoel, 3 years ago (diff)

First batch of changes for Eraser.DefaultPlugins?. There are plenty of build errors in this one, but let's solve them one at a time.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2010 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By:
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.Linq;
25using System.Text;
26
27using System.Runtime.Serialization;
28using System.Runtime.InteropServices;
29using System.IO;
30
31using Eraser.Util;
32using Eraser.Plugins;
33using Eraser.Plugins.ExtensionPoints;
34
35namespace Eraser.DefaultPlugins
36{
37    /// <summary>
38    /// Class representing a file to be erased.
39    /// </summary>
40    [Serializable]
41    [Guid("0D741505-E1C4-400d-8470-598AF35E174D")]
42    class FileErasureTarget : FileSystemObjectErasureTarget
43    {
44        #region Serialization code
45        protected FileErasureTarget(SerializationInfo info, StreamingContext context)
46            : base(info, context)
47        {
48        }
49        #endregion
50
51        /// <summary>
52        /// Constructor.
53        /// </summary>
54        public FileErasureTarget()
55        {
56        }
57
58        public override Guid Guid
59        {
60            get { return GetType().GUID; }
61        }
62
63        public override string Name
64        {
65            get { return S._("File"); }
66        }
67
68        public override IErasureTargetConfigurer Configurer
69        {
70            get { return new FileErasureTargetConfigurer(); }
71        }
72
73        protected override List<StreamInfo> GetPaths()
74        {
75            List<StreamInfo> result = new List<StreamInfo>();
76            FileInfo fileInfo = new FileInfo(Path);
77
78            if (fileInfo.Exists)
79            {
80                result.AddRange(GetPathADSes(fileInfo));
81                result.Add(new StreamInfo(Path));
82            }
83
84            return result;
85        }
86
87        public override void Execute()
88        {
89            Progress = new SteppedProgressManager();
90
91            try
92            {
93                base.Execute();
94            }
95            finally
96            {
97                Progress = null;
98            }
99        }
100    }
101}
Note: See TracBrowser for help on using the repository browser.