From 171a0c1fc393876f2f8b0b1cc778029815962beb Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Fri, 26 Apr 2019 14:42:48 +0200
Subject: [PATCH] Add StorageStatus.AllDrivesAboveThreshold

Refers to #20
---
 ATxCommon/StorageStatus.cs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ATxCommon/StorageStatus.cs b/ATxCommon/StorageStatus.cs
index f6002dd..f083aca 100644
--- a/ATxCommon/StorageStatus.cs
+++ b/ATxCommon/StorageStatus.cs
@@ -48,6 +48,21 @@ namespace ATxCommon
             }
         }
 
+        /// <summary>
+        /// Check if free space on all configured drives is above their threshold.
+        /// </summary>
+        /// <returns>False if any of the drives is below its threshold, true otherwise.</returns>
+        public bool AllDrivesAboveThreshold() {
+            UpdateFreeSpace();
+            foreach (var drive in _drives) {
+                if (drive.DiskSpaceLow()) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
         /// <summary>
         /// Get a dictionary of expired directories from the grace location.
         /// </summary>
-- 
GitLab