From 89bba097c32a7d42a084dd3829404c2704e9c633 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Wed, 17 Jan 2018 23:12:46 +0100
Subject: [PATCH] Move byte size constants to ATXCommon.Conv.

---
 AutoTx/AutoTx.cs       | 3 ---
 AutoTx/RoboCommand.cs  | 2 +-
 AutoTx/SystemChecks.cs | 3 ++-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs
index 7263467..e3ee62c 100644
--- a/AutoTx/AutoTx.cs
+++ b/AutoTx/AutoTx.cs
@@ -35,9 +35,6 @@ 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/RoboCommand.cs b/AutoTx/RoboCommand.cs
index ae4c4c5..0078517 100644
--- a/AutoTx/RoboCommand.cs
+++ b/AutoTx/RoboCommand.cs
@@ -73,7 +73,7 @@ namespace AutoTx
                 _roboCommand.RetryOptions.RetryWaitTime = 2;
                 _roboCommand.Start();
                 Log.Info("Transfer started, total size: {0} MB",
-                    _status.CurrentTransferSize / MegaBytes);
+                    _status.CurrentTransferSize / Conv.MegaBytes);
             }
             catch (ManagementException ex) {
                 Log.Error("Error in StartTransfer(): {0}", ex.Message);
diff --git a/AutoTx/SystemChecks.cs b/AutoTx/SystemChecks.cs
index 31b7aef..cbda3a2 100644
--- a/AutoTx/SystemChecks.cs
+++ b/AutoTx/SystemChecks.cs
@@ -2,6 +2,7 @@
 using System.Diagnostics;
 using System.IO;
 using System.Management;
+using ATXCommon;
 
 namespace AutoTx
 {
@@ -55,7 +56,7 @@ namespace AutoTx
         private long GetFreeDriveSpace(string drive) {
             try {
                 var dInfo = new DriveInfo(drive);
-                return dInfo.TotalFreeSpace / MegaBytes;
+                return dInfo.TotalFreeSpace / Conv.MegaBytes;
             }
             catch (Exception ex) {
                 Log.Warn("Error in GetFreeDriveSpace({0}): {1}", drive, ex.Message);
-- 
GitLab