Changeset 2181 for trunk/eraser


Ignore:
Timestamp:
6/18/2010 9:54:08 AM (4 years ago)
Author:
lowjoel
Message:
  • Define the VolumeInfo?.PhysicalDrive? property to get the physical drive the volume is on
  • Define the VolumeInfo?.Equals function to check whether two VolumeInfo? instances are equal (it is a class type but should exhibit value type behaviour)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Util/VolumeInfo.cs

    r2179 r2181  
    566566 
    567567        /// <summary> 
     568        /// Gets the Physical Drive this Volume is in. 
     569        /// </summary> 
     570        public PhysicalDriveInfo PhysicalDrive 
     571        { 
     572            get 
     573            { 
     574                foreach (PhysicalDriveInfo info in PhysicalDriveInfo.Drives) 
     575                { 
     576                    if (info.Volumes.IndexOf(this) != -1) 
     577                        return info; 
     578                } 
     579 
     580                return null; 
     581            } 
     582        } 
     583 
     584        /// <summary> 
    568585        /// Opens a file with read, write, or read/write access. 
    569586        /// </summary> 
     
    697714            IList<DirectoryInfo> mountPoints = MountPoints; 
    698715            return mountPoints.Count == 0 ? VolumeId : mountPoints[0].FullName; 
     716        } 
     717 
     718        public override bool Equals(object obj) 
     719        { 
     720            VolumeInfo rhs = obj as VolumeInfo; 
     721            if (rhs == null) 
     722                return base.Equals(obj); 
     723 
     724            return VolumeId == rhs.VolumeId; 
    699725        } 
    700726 
Note: See TracChangeset for help on using the changeset viewer.