Ejemplo n.º 1
0
        private bool IsDestinationDriveFull(string destinationRootPath, long freeSpaceToLeaveOnDestination)
        {
            var  driveInfo          = DriveInfoProvider.GetDriveInfoForPath(destinationRootPath);
            long availableFreeSpace = driveInfo.AvailableFreeSpace;

            long   freeKb = 0;
            double freeMb = 0;
            double freeGb = 0;

            if (availableFreeSpace > 0)
            {
                freeKb = (availableFreeSpace / 1024);
            }
            if (freeKb > 0)
            {
                freeMb = (freeKb / 1024);
            }
            if (freeMb > 0)
            {
                freeGb = (freeMb / 1024);
            }

            if (freeMb < freeSpaceToLeaveOnDestination)
            {
                OnStatusUpdate(string.Format(CultureInfo.InvariantCulture, "Destination drive is full leaving {0:#,0.##} MB free", freeSpaceToLeaveOnDestination));
                OnStatusUpdate(string.Format(CultureInfo.InvariantCulture, "Free Space on drive {0} is {1:#,0.##} KB, {2:#,0.##} MB, {3:#,0.##} GB", driveInfo.Name, freeKb, freeMb, freeGb));
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
 protected override void When()
 {
     try
     {
         DriveInfoProvider.GetDriveInfoForPath(@"mtp:\test device\a\b\c");
     }
     catch (Exception exception)
     {
         ThrownException = exception;
     }
 }
Ejemplo n.º 3
0
 protected override void When()
 {
     DriveInfo = DriveInfoProvider.GetDriveInfoForPath(@"mtp:\test device\storage\b\c");
 }