Example #1
0
 public async void getFSInfo(IPromise promise)
 {
     try
     {
         DiskStatus status = new DiskStatus();
         DiskUtil.DriveFreeBytes(KnownFolders.RoamingAppData.Path, out status);
         promise.Resolve(new JObject
         {
             { "freeSpace", status.free },
             { "totalSpace", status.total },
         });
     }
     catch (Exception)
     {
         promise.Reject(null, "getFSInfo is not available");
     }
 }
Example #2
0
        public static bool DriveFreeBytes(string folderName, out DiskStatus status)
        {
            if (string.IsNullOrEmpty(folderName))
            {
                throw new ArgumentNullException("folderName");
            }

            if (!folderName.EndsWith("\\"))
            {
                folderName += '\\';
            }

            ulong dummy;

            if (GetDiskFreeSpaceEx(folderName, out status.free, out status.total, out dummy))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }