/// <summary> /// Gets the first partition, if any, of the specified disk. /// </summary> /// <param name="disk">The disk to get the first partition of.</param> /// <returns>The partition or null if none found.</returns> public static Partition GetFirstPartition(DiskDevice disk) { for (int i = 0; i < FOS_System.IO.FileSystemManager.Partitions.Count; i++) { FOS_System.IO.Partition part = (FOS_System.IO.Partition)FOS_System.IO.FileSystemManager.Partitions[i]; if (part.TheDiskDevice == disk) { return(part); } } return(null); }
/// <summary> /// Determines whether the specified disk has had any valid partitions detected. /// </summary> /// <param name="disk">The disk to check.</param> /// <returns>Whether the specified disk has had any valid partitions detected.</returns> public static bool HasPartitions(DiskDevice disk) { for (int i = 0; i < FOS_System.IO.FileSystemManager.Partitions.Count; i++) { FOS_System.IO.Partition part = (FOS_System.IO.Partition)FOS_System.IO.FileSystemManager.Partitions[i]; if (part.TheDiskDevice == disk) { return(true); } } return(false); }