internal static FileSystem[] GetDrives() { List <FileSystem> allDrives = new List <FileSystem>(); DriveInfo[] drives = DriveInfo.GetDrives(); foreach (DriveInfo wdi in drives) { try{ FileSystem sd = new FileSystem(); sd.MountPoint = wdi.Name; sd.OriginalMountPoint = wdi.Name; sd.Size = wdi.TotalSize; sd.AvailableFreeSpace = wdi.AvailableFreeSpace; sd.Path = wdi.VolumeLabel; sd.DriveFormat = wdi.DriveFormat; sd.Label = wdi.VolumeLabel; //sd.DriveType = wdi.DriveType; try{ sd.SnapshotType = FilesystemManager.GetDriveSnapshotType(sd.MountPoint); allDrives.Add(sd); } catch {} } catch {} // dirve not ready windows error } return(allDrives.ToArray()); }
internal static FileSystem[] GetDrives() { List <FileSystem> allDrives = new List <FileSystem>(); UnixDriveInfo[] drives = UnixDriveInfo.GetDrives(); foreach (UnixDriveInfo udi in drives) { // We exclude some irrelevant (pseudo)filesystems /*if(udi.DriveFormat == "proc" || udi.DriveFormat == "sysfs" || udi.DriveFormat == "debugfs" || udi.DriveFormat == "devpts" || udi.DriveFormat == "procfs") || continue;*/ FileSystem sd = new FileSystem(); sd.MountPoint = udi.Name; sd.OriginalMountPoint = udi.Name; //sd.Name = udi.VolumeLabel; sd.Size = udi.TotalSize; sd.AvailableFreeSpace = udi.AvailableFreeSpace; sd.Path = udi.VolumeLabel; //sd.Path = udi.Name; sd.DriveFormat = udi.DriveFormat; //sd.DriveType = (DriveType)udi.DriveType; try{ sd.SnapshotType = FilesystemManager.GetDriveSnapshotType(sd.MountPoint); } catch {} allDrives.Add(sd); } return(allDrives.ToArray()); }
private List <FileSystem> GetMountedFilesystems() { List <FileSystem> fses = new List <FileSystem>(); fses.AddRange(FilesystemManager.Instance().GetAllDrives()); return(fses); }
public static FilesystemManager Instance() { if (_instance == null) { _instance = new FilesystemManager(); } return(_instance); }
/// <summary> /// Builds a "fake" layout containing 1 fake disk, having 1 fake partition, /// containing all the mounted available filesystems /// </summary> /// <returns> /// The storage layout. /// </returns> public StorageLayout BuildStorageLayout() { var layout = new StorageLayout(); var disk = new Disk { Path = "?" }; var partition = new Partition { Path = "?" }; foreach (FileSystem fs in FilesystemManager.Instance().GetAllDrives()) { partition.AddChild(fs); } disk.AddChild(partition); layout.Entries.Add(disk); return(layout); }