Changeset 1156


Ignore:
Timestamp:
7/3/2009 8:19:22 AM (5 years ago)
Author:
lowjoel
Message:

Fixed some FxCop? warnings
-Seal all our default plugins' erasure methods since they are not supposed to be inherited
-Don't return a List from the Unlocker module (now returns ReadOnlyCollection?)
-Call GC.SuppressFinalize? when using the Disposable Registry Settings manager
-Declare the Modified field of the BuildInfo? class to be const instead of readonly

Location:
trunk/eraser6
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Eraser.DefaultPlugins/EraseDoD.cs

    r956 r1156  
    2828namespace Eraser.DefaultPlugins 
    2929{ 
    30     class DoD_EcE : PassBasedErasureMethod 
     30    sealed class DoD_EcE : PassBasedErasureMethod 
    3131    { 
    3232        public override string Name 
     
    7474    } 
    7575 
    76     class DoD_E : PassBasedErasureMethod 
     76    sealed class DoD_E : PassBasedErasureMethod 
    7777    { 
    7878        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseFirstLast16KB.cs

    r1100 r1156  
    3232namespace Eraser.DefaultPlugins 
    3333{ 
    34     class FirstLast16KB : ErasureMethod 
     34    sealed class FirstLast16KB : ErasureMethod 
    3535    { 
    3636        public FirstLast16KB() 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseGOSTP50739.cs

    r1002 r1156  
    3131namespace Eraser.DefaultPlugins 
    3232{ 
    33     class GOSTP50739 : PassBasedErasureMethod 
     33    sealed class GOSTP50739 : PassBasedErasureMethod 
    3434    { 
    3535        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseGutmann.cs

    r956 r1156  
    3535    [DefaultFileErasure(1)] 
    3636    [Guid("1407FC4E-FEFF-4375-B4FB-D7EFBB7E9922")] 
    37     public class Gutmann : PassBasedErasureMethod 
     37    sealed class Gutmann : PassBasedErasureMethod 
    3838    { 
    3939        public override string Name 
     
    9898    } 
    9999 
    100     class GutmannLite : PassBasedErasureMethod 
     100    sealed class GutmannLite : PassBasedErasureMethod 
    101101    { 
    102102        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseHMGIS5.cs

    r1002 r1156  
    3131namespace Eraser.DefaultPlugins 
    3232{ 
    33     class HMGIS5Baseline : PassBasedErasureMethod 
     33    sealed class HMGIS5Baseline : PassBasedErasureMethod 
    3434    { 
    3535        public override string Name 
     
    6060    } 
    6161 
    62     class HMGIS5Enhanced : PassBasedErasureMethod 
     62    sealed class HMGIS5Enhanced : PassBasedErasureMethod 
    6363    { 
    6464        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseRCMP_TSSIT_OPS_II.cs

    r1002 r1156  
    3131namespace Eraser.DefaultPlugins 
    3232{ 
    33     class RCMP_TSSIT_OPS_II : PassBasedErasureMethod 
     33    sealed class RCMP_TSSIT_OPS_II : PassBasedErasureMethod 
    3434    { 
    3535        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseRandom.cs

    r956 r1156  
    3232    [DefaultUnusedSpaceErasure(1)] 
    3333    [Guid("BF8BA267-231A-4085-9BF9-204DE65A6641")] 
    34     class Pseudorandom : PassBasedErasureMethod 
     34    sealed class Pseudorandom : PassBasedErasureMethod 
    3535    { 
    3636        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseSchneier.cs

    r956 r1156  
    2828namespace Eraser.DefaultPlugins 
    2929{ 
    30     class Schneier : PassBasedErasureMethod 
     30    sealed class Schneier : PassBasedErasureMethod 
    3131    { 
    3232        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseUSAF5020.cs

    r1002 r1156  
    3131namespace Eraser.DefaultPlugins 
    3232{ 
    33     class USAF5020 : PassBasedErasureMethod 
     33    sealed class USAF5020 : PassBasedErasureMethod 
    3434    { 
    3535        public override string Name 
  • trunk/eraser6/Eraser.DefaultPlugins/EraseUSArmyAR380_19.cs

    r1002 r1156  
    3131namespace Eraser.DefaultPlugins 
    3232{ 
    33     class USArmyAR380_19 : PassBasedErasureMethod 
     33    sealed class USArmyAR380_19 : PassBasedErasureMethod 
    3434    { 
    3535        public override string Name 
  • trunk/eraser6/Eraser.Manager/DirectExecutor.cs

    r1154 r1156  
    600600                            delegate(long lastWritten, int currentPass) 
    601601                            { 
    602                                 progress.Completed += lastWritten; 
     602                                progress.Completed = Math.Min(progress.Total, 
     603                                    progress.Completed + lastWritten); 
    603604                                progress.Event.CurrentItemPass = currentPass; 
    604605                                progress.Event.CurrentItemProgress = progress.Progress; 
     
    945946                catch (FileLoadException) 
    946947                { 
    947                     List<OpenHandle> openHandles = OpenHandle.Items; 
    948948                    List<System.Diagnostics.Process> processes = new List<System.Diagnostics.Process>(); 
    949                     foreach (OpenHandle handle in openHandles) 
     949                    foreach (OpenHandle handle in OpenHandle.Items) 
    950950                        if (handle.Path == paths[i]) 
    951951                            processes.Add(System.Diagnostics.Process.GetProcessById(handle.ProcessId)); 
  • trunk/eraser6/Eraser.Unlocker/Eraser.Unlocker.cpp

    r1094 r1156  
    2525namespace Eraser { 
    2626namespace Unlocker { 
    27     List<OpenHandle^>^ OpenHandle::Items::get() 
     27    ReadOnlyCollection<OpenHandle^>^ OpenHandle::Items::get() 
    2828    { 
    2929        List<OpenHandle^>^ handles = gcnew List<OpenHandle^>(); 
     
    6868        } 
    6969 
    70         return handles; 
     70        return handles->AsReadOnly(); 
    7171    } 
    7272 
  • trunk/eraser6/Eraser.Unlocker/Eraser.Unlocker.h

    r1094 r1156  
    2626using namespace System; 
    2727using namespace System::Collections::Generic; 
     28using namespace System::Collections::ObjectModel; 
    2829using namespace Microsoft::Win32::SafeHandles; 
    2930 
     
    4849    public: 
    4950        /// Retrieves all open handles on the system 
    50         static property List<OpenHandle^>^ Items 
     51        static property ReadOnlyCollection<OpenHandle^>^ Items 
    5152        { 
    52             List<OpenHandle^>^ get(); 
     53            ReadOnlyCollection<OpenHandle^>^ get(); 
    5354        } 
    5455 
  • trunk/eraser6/Eraser.fxcop

    r1103 r1156  
    5656  <Settings /> 
    5757 </Rules> 
    58  <FxCopReport Version="1.36" LastAnalysis="2009-06-02 07:39:56Z"> 
     58 <FxCopReport Version="1.36" LastAnalysis="2009-07-03 06:57:16Z"> 
    5959  <Namespaces> 
    6060   <Namespace Name="Eraser.Unlocker"> 
     
    112112          </Members> 
    113113         </Type> 
    114          <Type Name="CommandLineProgram+CommandLine"> 
    115           <Members> 
    116            <Member Name="#.ctor(System.String[])"> 
    117             <Messages> 
    118              <Message TypeName="DoNotCallOverridableMethodsInConstructors" Category="Microsoft.Usage" CheckId="CA2214" Created="2009-06-02 07:17:10Z"> 
    119               <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="593"> 
    120                <Item>'CommandLineProgram.CommandLine.CommandLine(string[])'</Item> 
    121                <Item>&#xD;&#xA;&#xD;&#xA;CommandLineProgram+CommandLine..ctor(String[])&#xD;&#xA;CommandLineProgram+CommandLine.ResolveParameter(String):Boolean</Item> 
    122               </Issue> 
    123              </Message> 
    124             </Messages> 
    125            </Member> 
    126           </Members> 
    127          </Type> 
    128114         <Type Name="GUIProgram"> 
    129115          <Members> 
     
    131117            <Messages> 
    132118             <Message TypeName="AvoidUncalledPrivateCode" Category="Microsoft.Performance" CheckId="CA1811" Status="Excluded" Created="2009-06-02 07:17:10Z"> 
    133               <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="540"> 
     119              <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="573"> 
    134120               <Item>'GUIProgram.OnExitInstance(object)'</Item> 
    135121              </Issue> 
     
    145131            <Messages> 
    146132             <Message Id="handle" TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804" Status="Excluded" Created="2009-06-02 07:17:10Z"> 
    147               <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="325"> 
     133              <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="358"> 
    148134               <Item>'GUIProgram.Run()'</Item> 
    149135               <Item>'handle'</Item> 
     
    165151            <Messages> 
    166152             <Message TypeName="DoNotCatchGeneralExceptionTypes" Category="Microsoft.Design" CheckId="CA1031" Created="2009-06-02 07:17:10Z"> 
    167               <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="101"> 
     153              <Issue Path="D:\Development\Projects\Eraser\Eraser" File="Program.cs" Line="105"> 
    168154               <Item>'Program.CommandMain(string[])'</Item> 
    169155               <Item>'Exception'</Item> 
     
    216202           <Member Name="#InstallUpdates(System.Object)"> 
    217203            <Messages> 
    218              <Message TypeName="DoNotRaiseReservedExceptionTypes" Category="Microsoft.Usage" CheckId="CA2201" Created="2009-06-02 07:17:10Z"> 
     204             <Message TypeName="DoNotRaiseReservedExceptionTypes" Category="Microsoft.Usage" CheckId="CA2201" Status="Excluded" Created="2009-06-02 07:17:10Z"> 
    219205              <Issue Name="TooGeneric" Path="D:\Development\Projects\Eraser\Eraser" File="UpdateForm.cs" Line="762"> 
    220206               <Item>'UpdateManager.InstallUpdates(object)'</Item> 
    221207               <Item>'ApplicationException'</Item> 
    222208              </Issue> 
     209              <Notes> 
     210               <User Name="Joel"> 
     211                <Note Id="17" /> 
     212               </User> 
     213              </Notes> 
    223214             </Message> 
    224215            </Messages> 
     
    322313            <Messages> 
    323314             <Message TypeName="DoNotCallOverridableMethodsInConstructors" Category="Microsoft.Usage" CheckId="CA2214" Created="2009-05-01 03:14:45Z"> 
    324               <Issue Path="D:\Development\Projects\Eraser\Eraser.Manager" File="DirectExecutor.cs" Line="1032"> 
     315              <Issue Path="D:\Development\Projects\Eraser\Eraser.Manager" File="DirectExecutor.cs" Line="1049"> 
    325316               <Item>'DirectExecutor.DirectExecutor()'</Item> 
    326317               <Item>&#xD;&#xA;&#xD;&#xA;DirectExecutor..ctor()&#xD;&#xA;Executor.set_TaskAdded(EventHandler&lt;TaskEventArgs&gt;):Void&#xD;&#xA;Executor.set_TaskDeleted(EventHandler&lt;TaskEventArgs&gt;):Void&#xD;&#xA;Executor.set_Tasks(ExecutorTasksCollection):Void</Item> 
     
    332323            <Messages> 
    333324             <Message TypeName="DoNotCastUnnecessarily" Category="Microsoft.Performance" CheckId="CA1800" Created="2009-05-01 03:14:45Z"> 
    334               <Issue Name="Parameter" Path="D:\Development\Projects\Eraser\Eraser.Manager" File="DirectExecutor.cs" Line="975"> 
     325              <Issue Name="Parameter" Path="D:\Development\Projects\Eraser\Eraser.Manager" File="DirectExecutor.cs" Line="977"> 
    335326               <Item>'target'</Item> 
    336327               <Item>'FolderTarget'</Item> 
     
    415406         </Type> 
    416407         <Type Name="ErasureTarget"> 
    417           <Messages> 
    418            <Message TypeName="IdentifiersShouldDifferByMoreThanCase" Category="Microsoft.Naming" CheckId="CA1708" Created="2009-05-01 03:14:45Z"> 
    419             <Issue Name="Member"> 
    420              <Item>'method'</Item> 
    421              <Item>Method</Item> 
    422             </Issue> 
    423            </Message> 
    424           </Messages> 
    425           <Members> 
    426            <Member Name="#method"> 
    427             <Messages> 
    428              <Message Id="method" TypeName="IdentifiersShouldBeCasedCorrectly" Category="Microsoft.Naming" CheckId="CA1709" Created="2009-05-01 03:14:45Z"> 
    429               <Issue Name="Member"> 
    430                <Item>method</Item> 
    431                <Item>'ErasureTarget.method'</Item> 
    432                <Item>Method</Item> 
    433               </Issue> 
    434              </Message> 
    435             </Messages> 
     408          <Members> 
     409           <Member Name="#Method"> 
     410            <Accessors> 
     411             <Accessor Name="#get_Method()"> 
     412              <Messages> 
     413               <Message TypeName="DoNotRaiseExceptionsInUnexpectedLocations" Category="Microsoft.Design" CheckId="CA1065" Created="2009-07-03 06:55:12Z" FixCategory="Breaking"> 
     414                <Issue Name="PropertyGetter" Level="Warning" Path="D:\Development\Projects\Eraser\Eraser.Manager" File="Task.cs" Line="294"> 
     415                 <Item>'ErasureTarget.Method.get()'</Item> 
     416                 <Item>'NotImplementedException'</Item> 
     417                </Issue> 
     418               </Message> 
     419              </Messages> 
     420             </Accessor> 
     421            </Accessors> 
    436422           </Member> 
    437423          </Members> 
     
    476462            <Messages> 
    477463             <Message Id="1#" TypeName="AvoidOutParameters" Category="Microsoft.Design" CheckId="CA1021" Created="2009-05-01 03:23:16Z"> 
    478               <Issue Path="D:\Development\Projects\Eraser\Eraser.Manager" File="Task.cs" Line="377"> 
     464              <Issue Path="D:\Development\Projects\Eraser\Eraser.Manager" File="Task.cs" Line="382"> 
    479465               <Item>'totalSize'</Item> 
    480466              </Issue> 
     
    766752            <Messages> 
    767753             <Message TypeName="DoNotCallOverridableMethodsInConstructors" Category="Microsoft.Usage" CheckId="CA2214" Created="2009-04-28 13:43:02Z"> 
    768               <Issue Path="D:\Development\Projects\Eraser\Eraser.DefaultPlugins" File="EraseFirstLast16KB.cs" Line="35"> 
     754              <Issue Path="D:\Development\Projects\Eraser\Eraser.DefaultPlugins" File="EraseFirstLast16KB.cs" Line="36"> 
    769755               <Item>'FirstLast16KB.FirstLast16KB()'</Item> 
    770                <Item>&#xD;&#xA;&#xD;&#xA;FirstLast16KB..ctor()&#xD;&#xA;ErasureMethod.get_Guid():Guid</Item> 
     756               <Item>&#xD;&#xA;&#xD;&#xA;FirstLast16KB..ctor()&#xD;&#xA;ErasureMethod.get_Name():String</Item> 
    771757              </Issue> 
    772758             </Message> 
     
    820806    <Note Id="15" Modified="2009-06-02 07:36:01Z">Unlocker is our assembly name, hence a proper noun</Note> 
    821807    <Note Id="16" Modified="2009-06-02 07:36:03Z">Unlocker is our assembly name, hence a proper noun</Note> 
     808    <Note Id="17" Modified="2009-07-03 07:02:50Z">Can't think of a better exception to use</Note> 
    822809   </User> 
    823810  </Notes> 
     
    859846    <Resolution Name="HResultOrErrorCode">{0} calls {1} but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.</Resolution> 
    860847   </Rule> 
     848   <Rule TypeName="DoNotRaiseExceptionsInUnexpectedLocations" Category="Microsoft.Design" CheckId="CA1065"> 
     849    <Resolution Name="PropertyGetter">{0} creates an exception of type {1}, an exception type that should not be raised in a property. If this exception instance might be raised, use a different exception type, convert this property into a method, or change this property's logic so that it no longer raises an exception.</Resolution> 
     850   </Rule> 
    861851   <Rule TypeName="DoNotRaiseReservedExceptionTypes" Category="Microsoft.Usage" CheckId="CA2201"> 
    862852    <Resolution Name="TooGeneric">{0} creates an exception of type {1}, an exception type that is not sufficiently specific and should never be raised by user code. If this exception instance might be thrown, use a different exception type.</Resolution> 
     
    867857   <Rule TypeName="FlagsEnumsShouldHavePluralNames" Category="Microsoft.Naming" CheckId="CA1714"> 
    868858    <Resolution Name="Default">If enumeration name {0} is singular, change it to a plural form.</Resolution> 
    869    </Rule> 
    870    <Rule TypeName="IdentifiersShouldBeCasedCorrectly" Category="Microsoft.Naming" CheckId="CA1709"> 
    871     <Resolution Name="Member">Correct the casing of '{0}' in member name {1} by changing it to '{2}'.</Resolution> 
    872859   </Rule> 
    873860   <Rule TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704"> 
     
    875862    <Resolution Name="Namespace">Correct the spelling of '{0}' in namespace name '{1}'.</Resolution> 
    876863   </Rule> 
    877    <Rule TypeName="IdentifiersShouldDifferByMoreThanCase" Category="Microsoft.Naming" CheckId="CA1708"> 
    878     <Resolution Name="Member">Change member names {0} and '{1}' so that they differ by more than case.</Resolution> 
    879    </Rule> 
    880864   <Rule TypeName="IdentifiersShouldNotMatchKeywords" Category="Microsoft.Naming" CheckId="CA1716"> 
    881865    <Resolution Name="Member">Rename virtual/interface member {0} so that it no longer conflicts with the reserved language keyword '{1}'. Using a reserved keyword as the name of a virtual/interface member makes it harder for consumers in other languages to override/implement the member.</Resolution> 
  • trunk/eraser6/Eraser/Program.cs

    r1155 r1156  
    13141314            { 
    13151315                Dispose(true); 
     1316                GC.SuppressFinalize(this); 
    13161317            } 
    13171318 
  • trunk/eraser6/Version.cs.in

    r1095 r1156  
    3030        public static readonly DateTime BuildDate = DateTime.Parse("$WCNOW$", 
    3131            System.Globalization.CultureInfo.InvariantCulture); 
    32         public static readonly bool CustomBuild = $WCMODS?true:false$; 
     32        public const bool CustomBuild = $WCMODS?true:false$; 
    3333    } 
    3434} 
Note: See TracChangeset for help on using the changeset viewer.