/// <summary> /// Gets a set of Indexes for available drives /// </summary> /// <param name="PassCount"></param> /// <returns></returns> public static DeviceReturn[] GetDrives(byte PassCount) { List<DeviceReturn> xReturn = new List<DeviceReturn>(); for (byte i = 0; i < PassCount; i++) { Drive xDrive = new Drive(i, DeviceType.PhysicalDrive); if (xDrive.Accessed) xReturn.Add(new DeviceReturn(i, DeviceType.PhysicalDrive)); } DriveInfo[] xlogics = DriveInfo.GetDrives(); foreach (DriveInfo x in xlogics) { if (x.DriveType == DriveType.Removable && x.IsReady) { Drive xDrive = new Drive(x.Name[0]); if (xDrive.Accessed) xReturn.Add(new DeviceReturn((byte)x.Name[0], DeviceType.LogicalDrive)); } } return xReturn.ToArray(); }
/// <summary> /// Sets a FATX Drive from an index /// </summary> /// <param name="DeviceIn"></param> public FATXDrive(DeviceReturn DeviceIn) { Drive xdrive = new Drive(DeviceIn.index, DeviceIn.type); if (!xdrive.Accessed) throw new Exception("Invalid input"); //if (!FATXManagement.IsFATX(ref xdrive, out xType)) // throw new Exception("Drive is not FATX"); xType = DriveTypes.USBFlashDrive; xactive = true; xDrive = xdrive; LoadPartitions(); }
/// <summary> /// Initializes a new FATX Drive Class from an already set Drive /// </summary> /// <param name="InDrive"></param> public FATXDrive(ref Drive InDrive) { if (!InDrive.Accessed) throw new Exception("Invalid input"); if (!FATXManagement.IsFATX(ref InDrive, out xType)) throw new Exception("Drive is not FATX"); xactive = true; xDrive = InDrive; LoadPartitions(); }
/// <summary> /// Determins if this Index is a FATX drive pointed index /// </summary> /// <param name="Device">Device to check</param> /// <param name="xType">Grabs the FATX type</param> /// <returns></returns> public static bool IsFATX(DeviceReturn Device, out DriveTypes xType) { Drive xDrive = new Drive(Device.index, Device.type); return IsFATX(ref xDrive, out xType); }
/// <summary> /// Is a FATX drive /// </summary> /// <param name="xDrive"></param> /// <param name="xType"></param> /// <returns></returns> public static bool IsFATX(ref Drive xDrive, out DriveTypes xType) { xType = DriveTypes.Unknown; if (xDrive == null) return false; xDrive.MakeHandle(); DJsIO xIO = new DriveIO(xDrive, true); return IsFATX(ref xIO, out xType); }
/// <summary> /// Gets a result of available set of FATX Drives from a set of Indexes /// </summary> /// <param name="Drives">General drive list</param> /// <returns></returns> public static DeviceReturn[] GetFATXDrives(DeviceReturn[] Drives) { List<DeviceReturn> xReturn = new List<DeviceReturn>(); for (int i = 0; i < Drives.Length; i++) { Drive xDrive = new Drive(Drives[i].index, Drives[i].type); DriveTypes xType = DriveTypes.Unknown; if (IsFATX(ref xDrive, out xType)) xReturn.Add(Drives[i]); } return xReturn.ToArray(); }