示例#1
0
        /// <summary> Static constructor for this class </summary>
        static Connected_Drives()
        {
            // Define the collection
            driveCollection = new myDriveInfo_Collection();

            // Populate the drives
            populate_drive_collection();
        }
示例#2
0
        /// <summary> Gets the collection of portable hard drives connected to this machine </summary>
        public static myDriveInfo_Collection Portable_Hard_Drives(DataTable AllPortables)
        {
            // Create a return collection
            myDriveInfo_Collection returnVal = new myDriveInfo_Collection();

            if (AllPortables != null)
            {
                // Step through each drive
                DataRow[] selected;
                foreach (myDriveInfo thisDrive in driveCollection)
                {
                    // See if there is a match in the database (i.e., is this a portable)
                    selected = AllPortables.Select("SerialNumber = '" + thisDrive.VolumeSerialNumber + "'");
                    if (selected.Length > 0)
                    {
                        returnVal.Add(new myDriveInfo(thisDrive.Name, thisDrive.VolumeName, thisDrive.VolumeSerialNumber, thisDrive.Type));
                    }
                }
            }

            // Return these
            return(returnVal);
        }
示例#3
0
 /// <summary> Constructore creates a new myDriveInfoEnumerator to iterate through
 /// the <see cref="myDriveInfo_Collection"/>. </summary>
 /// <param name="myDriveInfo_Collection"> <see cref="myDriveInfo_Collection"/> to iterate through </param>
 public myDriveInfoEnumerator(myDriveInfo_Collection myDriveInfo_Collection)
 {
     myDriveInfos = myDriveInfo_Collection;
 }