diff --git a/QuickLook/Plugin/InfoPanel/FileHelper.cs b/QuickLook/Plugin/InfoPanel/FileHelper.cs index e5dc611..c3324f8 100644 --- a/QuickLook/Plugin/InfoPanel/FileHelper.cs +++ b/QuickLook/Plugin/InfoPanel/FileHelper.cs @@ -6,6 +6,16 @@ namespace QuickLook.Plugin.InfoPanel { public static class FileHelper { + public static void GetDriveSpace(string path, out long totalSpace, out long totalFreeSpace) + { + totalSpace = totalFreeSpace = 0L; + + var root = new DriveInfo(Path.GetPathRoot(path)); + + totalSpace = root.TotalSize; + totalFreeSpace = root.AvailableFreeSpace; + } + public static void CountFolder(string root, ref bool stop, out long totalDirs, out long totalFiles, out long totalSize) { diff --git a/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs index dcb3049..18a44fd 100644 --- a/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs +++ b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs @@ -51,6 +51,19 @@ namespace QuickLook.Plugin.InfoPanel Dispatcher.Invoke(() => { totalSize.Text = size.ToPrettySize(2); }); } + else if (Path.GetPathRoot(path) == path) // is this a drive? + { + long totalSpace; + long totalFreeSpace; + + FileHelper.GetDriveSpace(path, out totalSpace, out totalFreeSpace); + + Dispatcher.Invoke(() => + { + totalSize.Text = + $"Capacity {totalSpace.ToPrettySize(2)}, {totalFreeSpace.ToPrettySize(2)} available"; + }); + } else if (Directory.Exists(path)) { long totalDirsL;