From 76cb10f3edf4709d8f90338dc3bc3768b4d4acb7 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Mon, 18 Sep 2017 18:15:05 +0200 Subject: [PATCH] Introduce global shortcuts for x-bytes factors. --- AutoTx/AutoTx.cs | 3 +++ AutoTx/SystemChecks.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index 5dd7a99..f4dfd51 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -29,6 +29,9 @@ namespace AutoTx private int _txProgress; + private const int MegaBytes = 1024 * 1024; + private const int GigaBytes = 1024 * 1024 * 1024; + private DateTime _lastUserDirCheck = DateTime.Now; // the transfer state: diff --git a/AutoTx/SystemChecks.cs b/AutoTx/SystemChecks.cs index 67a0489..4e7cad2 100644 --- a/AutoTx/SystemChecks.cs +++ b/AutoTx/SystemChecks.cs @@ -61,7 +61,7 @@ namespace AutoTx private long GetFreeDriveSpace(string drive) { try { var dInfo = new DriveInfo(drive); - return dInfo.TotalFreeSpace / 1048576; // convert bytes to MB + return dInfo.TotalFreeSpace / MegaBytes; } catch (Exception ex) { writeLog("Error in GetFreeDriveSpace(" + drive + "): " + ex.Message); -- GitLab