Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
Added the possibility to get the drive with the highest free space (#345
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lpeyr committed Aug 2, 2022
1 parent 1624d59 commit a0a7489
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions LeoCorpLibrary/Env.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

Expand Down Expand Up @@ -555,6 +556,8 @@ public static void LaunchUWPApp(string packageFamilyName, string applicationID)
/// <returns>A <see cref="double"/> value, between 0 and 1.</returns>
public static double GetOccupiedSpacePercentage(DriveInfo driveInfo) => (driveInfo.TotalSize - driveInfo.TotalFreeSpace) / (double)driveInfo.TotalSize;

public static DriveInfo GetDriveWithHighestFreeSpace() => DriveInfo.GetDrives().OrderBy(d => d.TotalFreeSpace).First();

/// <summary>
/// Gets the current <see cref="SystemThemes"/> of the operating system (Windows only).
/// </summary>
Expand Down

0 comments on commit a0a7489

Please sign in to comment.