From c46fcbd95d3d5680a95b683bc052253fcdf2226f Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Wed, 13 Dec 2017 10:13:24 +0100
Subject: [PATCH] Rename FilecopyFinished to TransferInProgress and invert
 boolean.

---
 AutoTx/AutoTx.cs                   | 10 +++++-----
 AutoTx/RoboCommand.cs              |  4 ++--
 AutoTx/XmlWrapper/ServiceStatus.cs | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs
index 63ce7c8..313ae52 100644
--- a/AutoTx/AutoTx.cs
+++ b/AutoTx/AutoTx.cs
@@ -256,7 +256,7 @@ namespace AutoTx
             writeLogDebug("------ Loaded status flags ------");
             writeLogDebug("CurrentTransferSrc: " + _status.CurrentTransferSrc);
             writeLogDebug("CurrentTargetTmp: " + _status.CurrentTargetTmp);
-            writeLogDebug("FilecopyFinished: " + _status.FilecopyFinished);
+            writeLogDebug("TransferInProgress: " + _status.TransferInProgress);
             writeLogDebug("LastStorageNotification: " +
                           _status.LastStorageNotification.ToString("yyyy-MM-dd HH:mm:ss"));
             writeLogDebug("LastAdminNotification: " +
@@ -358,7 +358,7 @@ namespace AutoTx
                 catch (Exception ex) {
                     writeLog("Error terminating the RoboCopy process: " + ex.Message, true);
                 }
-                _status.FilecopyFinished = false;
+                _status.TransferInProgress = true;
                 writeLog("Not all files were transferred - will resume upon next start");
                 writeLogDebug("CurrentTransferSrc: " + _status.CurrentTransferSrc);
                 // should we delete an incompletely transferred file on the target?
@@ -654,7 +654,7 @@ namespace AutoTx
             // only happens while all system parameters are within their valid ranges
 
             // make sure the service is in an expected state before cleaning up:
-            if (_transferState != TxState.Stopped || _status.FilecopyFinished != true)
+            if (_transferState != TxState.Stopped || _status.TransferInProgress)
                 return;
             
             if (_status.CurrentTargetTmp.Length > 0) {
@@ -684,10 +684,10 @@ namespace AutoTx
             // CONDITIONS (a transfer has to be resumed):
             // - CurrentTargetTmp has to be non-empty
             // - TransferState has to be "Stopped"
-            // - FileCopyFinished must be false
+            // - TransferInProgress must be true
             if (_status.CurrentTargetTmp.Length <= 0 ||
                 _transferState != TxState.Stopped ||
-                _status.FilecopyFinished)
+                _status.TransferInProgress == false)
                 return;
 
             writeLogDebug("Resuming transfer from '" + _status.CurrentTransferSrc +
diff --git a/AutoTx/RoboCommand.cs b/AutoTx/RoboCommand.cs
index 4cfa85b..cbce886 100644
--- a/AutoTx/RoboCommand.cs
+++ b/AutoTx/RoboCommand.cs
@@ -27,7 +27,7 @@ namespace AutoTx
             CreateNewDirectory(ExpandCurrentTargetTmp(), false);
 
             _transferState = TxState.Active;
-            _status.FilecopyFinished = false;
+            _status.TransferInProgress = true;
             try {
                 // events
                 _roboCommand.OnCopyProgressChanged += RsProgressChanged;
@@ -136,7 +136,7 @@ namespace AutoTx
             _transferState = TxState.Stopped;
             _roboCommand.Dispose();
             _roboCommand = new RoboCommand();
-            _status.FilecopyFinished = true;
+            _status.TransferInProgress = false;
         }
 
         /// <summary>
diff --git a/AutoTx/XmlWrapper/ServiceStatus.cs b/AutoTx/XmlWrapper/ServiceStatus.cs
index 8ed046c..4cd705a 100644
--- a/AutoTx/XmlWrapper/ServiceStatus.cs
+++ b/AutoTx/XmlWrapper/ServiceStatus.cs
@@ -17,7 +17,7 @@ namespace AutoTx.XmlWrapper
         string _currentTransferSrc;
         string _currentTargetTmp;
 
-        bool _filecopyFinished;
+        bool _transferInProgress;
         private bool _serviceSuspended;
         private bool _cleanShutdown;
 
@@ -83,10 +83,10 @@ namespace AutoTx.XmlWrapper
             }
         }
 
-        public bool FilecopyFinished {
-            get { return _filecopyFinished; }
+        public bool TransferInProgress {
+            get { return _transferInProgress; }
             set {
-                _filecopyFinished = value;
+                _transferInProgress = value;
                 log("FilecopyFinished was updated (" + value + "), calling Serialize()...");
                 Serialize();
             }
@@ -115,7 +115,7 @@ namespace AutoTx.XmlWrapper
         public ServiceStatus() {
             _currentTransferSrc = "";
             _currentTargetTmp = "";
-            _filecopyFinished = true;
+            _transferInProgress = false;
         }
 
         public void Serialize() {
-- 
GitLab