Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        public ProcMount(DriveType driveType, string name, string mount, string type, Dictionary <string, string> options)
        {
            DriveType     = driveType;
            Name          = name;
            RootDirectory = mount;
            DriveFormat   = type;

            _unixDriveInfo = new UnixDriveInfo(mount);
        }
Esempio n. 3
0
        ///<summary>
        ///Constructor
        ///</summary>
        public DataStore(string datapath)
        {
            this.DataPath = datapath;
            this.FullPath = Store.StorePath;
            UnixDriveInfo mntpt = new UnixDriveInfo(this.FullPath);

            this.AvailableFreeSpace = mntpt.AvailableFreeSpace;
            this.Enabled            = true;
        }
Esempio n. 4
0
        public ProcMount(DriveType driveType, string name, string mount, string type, MountOptions mountOptions)
        {
            DriveType     = driveType;
            Name          = name;
            RootDirectory = mount;
            DriveFormat   = type;
            MountOptions  = mountOptions;

            _unixDriveInfo = new UnixDriveInfo(mount);
        }
Esempio n. 5
0
 ///<summary>
 ///Constructor
 ///</summary>
 public DataStore(string datapath, string fullpath, bool enabled)
 {
     try
     {
         this.DataPath = datapath;
         this.FullPath = fullpath;
         UnixDriveInfo mntpt = new UnixDriveInfo(this.FullPath);
         this.AvailableFreeSpace = mntpt.AvailableFreeSpace;
         this.Enabled            = enabled;
     }
     catch
     {
         //Ignore if the Volume is not mounted.
     }
 }
Esempio n. 6
0
        // if running on Mono
        #if __MonoCS__
        public static bool DriveFreeBytes(string folderName, out ulong freespace, out ulong total)
        {
            freespace = 0;
            total     = 0;

            UnixDriveInfo[] drives = UnixDriveInfo.GetDrives();
            int             idx = -1, count = -1;

            for (int i = 0; i < drives.Length; ++i)
            {
                if (folderName.StartsWith(drives[i].Name) && drives[i].Name.Length > count)
                {
                    count = drives[i].Name.Length;
                    idx   = i;
                }
            }

            // Drive for path is: drives[idx].Name
            freespace = (ulong)drives[idx].AvailableFreeSpace;
            total     = (ulong)drives[idx].TotalSize;
            return(true);
        }
Esempio n. 7
0
 ///<summary>
 ///Constructor
 ///</summary>
 public DataStore(string datapath, string fullpath, string enabled)
 {
     try
     {
         this.DataPath = datapath;
         this.FullPath = fullpath;
         string        enable = "True";
         UnixDriveInfo mntpt  = new UnixDriveInfo(this.FullPath);
         this.AvailableFreeSpace = mntpt.AvailableFreeSpace;
         if (enabled.Equals(enable))
         {
             this.Enabled = true;
         }
         else
         {
             this.Enabled = false;
         }
     }
     catch
     {
         //Ignore if the Volume is not mounted.
     }
 }
 public CloudComputingDriveInfo(string name, string dirPath)
 {
     this.driveInfo = new UnixFileInfo(dirPath).GetDriveInfo();
     this.name      = name;
 }
Esempio n. 9
0
 public void Rescan()
 {
     drive = new UnixDriveInfo(MountPoint);
 }