commit f281acacfc4892b73d2f71743167be2c1ebb1a84
Author: silhavyj <jakub.sil@seznam.cz>
Date:   Sun Apr 17 12:08:38 2022 +0200

    re #9566 Added InfoFetcher.cs, modified some other files (a bit of refactoring)

diff --git a/ld_client/LDClient/Program.cs b/ld_client/LDClient/Program.cs
index a161b8d..577a284 100644
--- a/ld_client/LDClient/Program.cs
+++ b/ld_client/LDClient/Program.cs
@@ -1,5 +1,3 @@
-using System.Runtime.InteropServices;
-using System.Security.Principal;
 using LDClient.detection;
 using LDClient.network;
 using LDClient.utils;
@@ -15,10 +13,13 @@ internal static class Program {
     public static ConfigLoader Config { get; } = new();
     public static ALogger DefaultLogger { get; } = ALogger.Current;
     private static IApiClient? DefaultApiClient { get; set; }
-    private static readonly NetworkDetection NetDetect = new(Config.ApiPort, Config.DetectionPeriod);
-    private static readonly ProcessDetection ProcDetect = new(Config.T32ProcessName, Config.DetectionPeriod);
     
-    // Main Method
+    private static readonly InfoFetcher InfoFetcher = new(
+        5,
+        1000,
+        "output.txt"
+    );
+    
     public static int Main() {
         var exists = GetProcessesByName(Path.GetFileNameWithoutExtension(GetEntryAssembly()?.Location)).Length > 1;
         if (exists) {
@@ -35,42 +36,27 @@ internal static class Program {
             Config.CacheFileName
         );
         
+        IProcessDetection processProcessDetection = new ProcessProcessDetection(
+            Config.T32ProcessName,
+            Config.DetectionPeriod,
+            InfoFetcher,
+            DefaultApiClient
+        );
+        
         DefaultLogger.Debug("Main -> starting the ApiClient");
         var apiClientThread = new Thread(DefaultApiClient.Run) {
             IsBackground = true
         };
         apiClientThread.Start();
 
-        var admin = IsAdministrator();
-        DefaultLogger.Debug($"Is program executed with admin rights? {admin}");
+        var processThread = new Thread(processProcessDetection.RunPeriodicDetection) {
+            IsBackground = true
+        };
+        processThread.Start();
 
-        var networkTread = new Thread(NetDetect.RunPeriodicDetection);
-        networkTread.Start();
-        
-        if (admin) {
-            ProcDetect.RegisterProcessListeners();
-        } else {
-            var processThread = new Thread(ProcDetect.RunPeriodicDetection);
-            processThread.Start();
-            processThread.Join();
+        while (true) {
+            Thread.Sleep(10 * 1000);
         }
-
-        networkTread.Join();
-
-        DefaultLogger.Debug("Main -> stopping the ApiClient");
-        DefaultApiClient.Stop();
-        apiClientThread.Join();
-        DefaultLogger.Debug("Main -> finished");
-        
         return 0;
     }
-
-    private static bool IsAdministrator() {
-        if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
-            return false;
-        }
-        var identity = WindowsIdentity.GetCurrent();
-        var principal = new WindowsPrincipal(identity);
-        return principal.IsInRole(WindowsBuiltInRole.Administrator);
-    }
 }
\ No newline at end of file
diff --git a/ld_client/LDClient/appsettings.json b/ld_client/LDClient/appsettings.json
index 910d880..ad06abf 100644
--- a/ld_client/LDClient/appsettings.json
+++ b/ld_client/LDClient/appsettings.json
@@ -14,7 +14,6 @@
     "LogVerbosityType": 2,
     "LogFlowType": 0
   },
-
   "Network": {
     "ApiBaseAddress": "http://127.0.0.1",
     "ApiLDEndPoint": "/lauterbach-debugger-logs/",
@@ -27,9 +26,7 @@
     "CacheFileName": "cache"
   },
   "DebuggerDetection": {
-    "T32Address": "localhost",
-    "T32Port": 20000,
-    "T32ProcessName": "t32mtc",
+    "T32ProcessName": "ld_mock",
     "T32InfoLocation": "C:\\app\\tools\\T32\\results\\ldResult.txt",
     "DetectionPeriod": 5000
   }
diff --git a/ld_client/LDClient/detection/IDetection.cs b/ld_client/LDClient/detection/IDetection.cs
deleted file mode 100644
index 4d42eea..0000000
--- a/ld_client/LDClient/detection/IDetection.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LDClient.detection {
-    internal interface IDetection {
-
-        public void DetectAsync();
-
-        public void RunPeriodicDetection();
-        public void StopPeriodicDetection();
-    }
-}
diff --git a/ld_client/LDClient/detection/IProcessDetection.cs b/ld_client/LDClient/detection/IProcessDetection.cs
new file mode 100644
index 0000000..26782e1
--- /dev/null
+++ b/ld_client/LDClient/detection/IProcessDetection.cs
@@ -0,0 +1,7 @@
+﻿namespace LDClient.detection {
+    
+    internal interface IProcessDetection {
+        
+        public void RunPeriodicDetection();
+    }
+}
\ No newline at end of file
diff --git a/ld_client/LDClient/detection/InfoFetcher.cs b/ld_client/LDClient/detection/InfoFetcher.cs
new file mode 100644
index 0000000..c224b31
--- /dev/null
+++ b/ld_client/LDClient/detection/InfoFetcher.cs
@@ -0,0 +1,72 @@
+using System.Diagnostics;
+using LDClient.utils;
+
+namespace LDClient.detection {
+
+    public class InfoFetcher {
+
+        private const string F32RemExecutable = "/home/silhavyj/School/KIV-ASWI/aswi2022bug-thugs/ld_client/Mock/t32rem/build/t32rem_mock";
+        private const string F32RemArguments = "localhost port=20000 VERSION.HARDWARE";
+        private const string UndefinedSerialNumber = "number";
+
+        private readonly int _maxAttempts;
+        private readonly int _waitPeriodMs;
+        private readonly string _infoFilePath;
+
+        public string HeadSerialNumber { get; private set; } = UndefinedSerialNumber;
+        public string BodySerialNumber { get; private set; } = UndefinedSerialNumber;
+
+        public InfoFetcher(int maxAttempts, int waitPeriodMs, string infoFilePath) {
+            _maxAttempts = maxAttempts;
+            _waitPeriodMs = waitPeriodMs;
+            _infoFilePath = infoFilePath;
+        }
+
+        public async Task<bool> FetchDataAsync() {
+            Program.DefaultLogger.Info("Fetching data from the debugger.");
+            var success = await SendRetrieveInfoCommandAsync(F32RemExecutable, F32RemArguments);
+            if (!success) {
+                Program.DefaultLogger.Error("Failed to fetch data from the debugger.");
+                return false;
+            }
+            for (var i = 0; i < _maxAttempts; i++) {
+                Program.DefaultLogger.Info($"{i}. attempt to parse the info file.");
+                if (RetrieveDebuggerInfo(_infoFilePath)) {
+                    Program.DefaultLogger.Info($"Info file has been parsed successfully.");
+                    return true;
+                }
+                await Task.Delay(_waitPeriodMs);
+            }
+            Program.DefaultLogger.Error("Failed to parse the into file. It may have not been created.");
+            return false;
+        }
+
+        private bool RetrieveDebuggerInfo(string filePath) {
+            try {
+                var fileContent = IoUtils.ReadFile(filePath);
+                var (headSerialNumber, bodySerialNumber) = DebuggerInfoParser.Parse(fileContent);
+                HeadSerialNumber = headSerialNumber;
+                BodySerialNumber = bodySerialNumber;
+                File.Delete(filePath);
+            } catch (Exception exception) {
+                Program.DefaultLogger.Error($"Failed to retrieve debugger info. File {filePath} may not exist or it does not have the right format. {exception.Message}");
+                return false;
+            }
+            return true;
+        }
+
+        private static async Task<bool> SendRetrieveInfoCommandAsync(string executableFile, string arguments) {
+            var t32RemProcess = new Process();
+            t32RemProcess.StartInfo.FileName = executableFile;
+            t32RemProcess.StartInfo.Arguments = arguments;
+            try {
+                t32RemProcess.Start();
+                await t32RemProcess.WaitForExitAsync();
+            } catch (Exception exception) {
+                Program.DefaultLogger.Error($"Failed to run {executableFile}. {exception.Message}");
+                return false;
+            }
+            return true;
+        }
+    }
+}
\ No newline at end of file
diff --git a/ld_client/LDClient/detection/NetworkDetection.cs b/ld_client/LDClient/detection/NetworkDetection.cs
deleted file mode 100644
index 83b0bcc..0000000
--- a/ld_client/LDClient/detection/NetworkDetection.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LDClient.detection {
-    public class NetworkDetection : IDetection {
-
-        private readonly uint _port;
-
-        private bool _isRunning;
-        
-        private readonly uint _detectionPeriod;
-
-        public NetworkDetection(uint port, uint detectionPeriod) {
-            this._port = port;
-            this._detectionPeriod = detectionPeriod;
-        }
-
-        public void DetectAsync() {
-
-            var listeners = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners();
-
-            Program.DefaultLogger.Debug($"NetworkDetection -> Checking all currently listening.");
-            foreach (var listener in listeners) {
-                //Program.DefaultLogger.Debug($"{listener.Address}:{listener.Port}");
-                if (listener.Port == _port) {
-                    Program.DefaultLogger.Info($"Found some process listening on {listener.Address}:{_port}");
-                }
-            }
-
-        }
-
-
-        public void RunPeriodicDetection() {
-            Program.DefaultLogger.Info("Network periodic detector has started");
-            _isRunning = true;
-            while (_isRunning) {
-                DetectAsync();
-                Thread.Sleep((int)_detectionPeriod);
-            }
-        }
-
-        public void StopPeriodicDetection() {
-            _isRunning = false;
-        }
-    }
-}
diff --git a/ld_client/LDClient/detection/ProcessDetection.cs b/ld_client/LDClient/detection/ProcessDetection.cs
deleted file mode 100644
index 77ebca2..0000000
--- a/ld_client/LDClient/detection/ProcessDetection.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System;
-using System.Management;
-
-namespace LDClient.detection {
-    public class ProcessDetection : IDetection {
-
-        private const string ProcessStartQuery = "SELECT * FROM Win32_ProcessStartTrace";
-        private const string ProcessStopQuery = "SELECT * FROM Win32_ProcessStopTrace";
-
-        private ManagementEventWatcher _stopWatch;
-
-        private bool _isRunning;
-
-        private readonly string _processName;
-        private readonly uint _detectionPeriod;
-        private bool _processActive;
-        public ProcessDetection(string processName, uint detectionPeriod) {
-            this._processName = processName;
-            this._detectionPeriod = detectionPeriod;
-        }
-
-
-        public void DetectAsync() {
-            var processes = Process.GetProcessesByName(_processName);
-            Program.DefaultLogger.Info($"Found {processes.Length} processes with name: {_processName}");
-            var processFound = false;
-            foreach (var process in processes) {
-                if (process.ProcessName.Equals(_processName)) {
-                    if (!_processActive) {
-                        Program.DefaultLogger.Info($"Process started: {_processName}");
-                    }
-                    _processActive = true;
-                    processFound = true;
-                    break;
-                }
-                Console.WriteLine(process);
-            }
-
-            if (!processFound) {
-                if (_processActive) {
-                    Program.DefaultLogger.Info($"Process stopped: {_processName}");
-                }
-                _processActive = false;
-            }
-        }
-
-
-        public void RunPeriodicDetection() {
-
-            Program.DefaultLogger.Info("Process periodic detector has started");
-            _isRunning = true;
-            while (_isRunning) {
-                DetectAsync();
-                Thread.Sleep((int)_detectionPeriod);
-            }
-        }
-
-        public void StopPeriodicDetection() {
-            _isRunning = false;
-        }
-
-
-        public void RegisterProcessListeners() {
-            ManagementEventWatcher startWatch = new ManagementEventWatcher(
-                new WqlEventQuery(ProcessStartQuery));
-            startWatch.EventArrived += startWatch_EventArrived;
-            startWatch.Start();
-
-            _stopWatch = new ManagementEventWatcher(
-                new WqlEventQuery(ProcessStopQuery));
-            _stopWatch.EventArrived += stopWatch_EventArrived;
-            _stopWatch.Start();
-        }
-
-        void stopWatch_EventArrived(object sender, EventArrivedEventArgs e) {
-            var processName = e.NewEvent.Properties["ProcessName"].Value.ToString();
-            if (processName.Equals(_processName + ".exe")) {
-                Program.DefaultLogger.Info($"Process stopped: {processName}");
-            }
-        }
-
-        void startWatch_EventArrived(object sender, EventArrivedEventArgs e) {
-            var processName = e.NewEvent.Properties["ProcessName"].Value.ToString();
-            if (processName.Equals(_processName + ".exe")) {
-                Program.DefaultLogger.Info($"Process started: {processName}");
-            }
-        }
-    }
-}
diff --git a/ld_client/LDClient/detection/ProcessProcessDetection.cs b/ld_client/LDClient/detection/ProcessProcessDetection.cs
new file mode 100644
index 0000000..d30f311
--- /dev/null
+++ b/ld_client/LDClient/detection/ProcessProcessDetection.cs
@@ -0,0 +1,87 @@
+﻿using System.Diagnostics;
+using LDClient.network;
+using LDClient.network.data;
+
+namespace LDClient.detection {
+   
+	 public class ProcessProcessDetection : IProcessDetection {
+        
+        private const string DatetimeFormat = "yyyy-MM-dd hh:mm:ss";
+        
+        private readonly string _processName;
+        private readonly uint _detectionPeriodMs;
+        private bool _processIsActive;
+        private bool _failedToRetrieveData;
+        private Payload? _lastlyConnected;
+
+        private readonly InfoFetcher _infoFetcher;
+        private readonly IApiClient _apiClient;
+
+        public ProcessProcessDetection(string processName, uint detectionPeriodMs, InfoFetcher infoFetcher, IApiClient apiClient) {
+            _processName = processName;
+            _detectionPeriodMs = detectionPeriodMs;
+            _infoFetcher = infoFetcher;
+            _apiClient = apiClient;
+            _failedToRetrieveData = false;
+        }
+
+        private async Task<bool> RetrieveDataFromDebugger() {
+            var success = await _infoFetcher.FetchDataAsync();
+            if (success) {
+                _lastlyConnected = await SendDataToServerAsync(_infoFetcher.HeadSerialNumber, _infoFetcher.BodySerialNumber, DatetimeFormat);
+            }
+            return success;
+        }
+
+        private async Task DebuggerDisconnected() {
+            if (_lastlyConnected is not null) {
+                _lastlyConnected.Status = ConnectionStatus.Disconnected;
+                _lastlyConnected.TimeStamp = DateTime.Now.ToString(DatetimeFormat);
+                await _apiClient.SendPayloadAsync(_lastlyConnected);
+                _lastlyConnected = null;
+            }
+        }
+
+        private async Task DetectProcessAsync() {
+            var processExists = Process.GetProcessesByName(_processName).Length > 0;
+
+            if (processExists && !_processIsActive) {
+                Program.DefaultLogger.Info($"Process started: {_processName}");
+                if (!_failedToRetrieveData) {
+                    _failedToRetrieveData = !await RetrieveDataFromDebugger();
+                }
+            } else if (!processExists && _processIsActive) {
+                Program.DefaultLogger.Info($"Process stopped: {_processName}");
+                _failedToRetrieveData = false;
+                await DebuggerDisconnected();
+            }
+            _processIsActive = processExists;
+        }
+        
+        private async Task<Payload> SendDataToServerAsync(string headSerialNumber, string bodySerialNumber, string datetimeFormat) {
+            Payload payload = new() {
+                UserName = Environment.UserName,
+                HostName = Environment.MachineName,
+                TimeStamp = DateTime.Now.ToString(datetimeFormat),
+                HeadDevice = new DebuggerInfo {
+                    SerialNumber = headSerialNumber
+                },
+                BodyDevice = new DebuggerInfo {
+                    SerialNumber = bodySerialNumber
+                },
+                Status = ConnectionStatus.Connected
+            };
+            await _apiClient.SendPayloadAsync(payload);
+            return payload;
+        }
+        
+        public async void RunPeriodicDetection() {
+            Program.DefaultLogger.Info("Process periodic detector has started");
+            while (true) {
+                await DetectProcessAsync();
+                Thread.Sleep((int)_detectionPeriodMs);
+            }
+            // ReSharper disable once FunctionNeverReturns
+        }
+    }
+}
diff --git a/ld_client/LDClient/network/ApiClient.cs b/ld_client/LDClient/network/ApiClient.cs
index dbbbf7b..61766cf 100644
--- a/ld_client/LDClient/network/ApiClient.cs
+++ b/ld_client/LDClient/network/ApiClient.cs
@@ -7,24 +7,9 @@ using DiskQueue;
 using LDClient.network.data;
 
 namespace LDClient.network {
+    
     public class ApiClient : IApiClient {
         
-        public static readonly Payload ExampleInfo = new() {
-            UserName = "honikCz",
-            HostName = "Bramborak",
-            TimeStamp = DateTime.Parse("2022-03-21 18:05:00.168895"),
-            HeadDevice = new DebuggerInfo {
-                SerialNumber = "C12345678912"
-            },
-            BodyDevice = new DebuggerInfo {
-                SerialNumber = "C98765432198"
-            },
-            Status = ConnectionStatus.Connected
-        };
-
-        private bool _running;
-
-
         private readonly string _uri;
         private readonly HttpClient _client;
         private readonly IPersistentQueue _cache;
@@ -32,8 +17,6 @@ namespace LDClient.network {
         private readonly uint _maxEntries;
         private readonly uint _maxRetries;
         
-
-
         public ApiClient(string url, uint port, string path, uint retryPeriod, uint maxEntries, uint maxRetries,
             string cacheFilename) {
             _uri = $"{url}:{port}{path}";
@@ -43,7 +26,6 @@ namespace LDClient.network {
 
             _client = new HttpClient();
             _cache = new PersistentQueue(cacheFilename);
-
         }
 
         public async Task SendPayloadAsync(Payload payload) {
@@ -55,7 +37,6 @@ namespace LDClient.network {
                     Converters = {
                         new JsonStringEnumConverter( JsonNamingPolicy.CamelCase)
                     }
-
                 });
                 stopWatch.Stop();
                 CreateRequestLog(payload, response, stopWatch.ElapsedMilliseconds);
@@ -80,7 +61,6 @@ namespace LDClient.network {
                                  $"Response: {responseToLog}");
         }
         
-
         private async Task ResendPayloadsAsync() {
             var numberOfPayloadsToResend = Math.Min(_maxRetries, _cache.EstimatedCountOfItemsInQueue);
             var payloads = new List<Payload>();
@@ -106,8 +86,7 @@ namespace LDClient.network {
                 await Task.WhenAll(tasks);
             }
         }
-
-
+        
         private void CachePayload(Payload payload) {
             Program.DefaultLogger.Info($"Storing {payload} into the cache.");
             var numberOfCachedPayloads = _cache.EstimatedCountOfItemsInQueue;
@@ -122,15 +101,11 @@ namespace LDClient.network {
 
         public async void Run() {
             Program.DefaultLogger.Info("Api Client thread has started");
-            _running = true;
-            while (_running) {
+            while (true) {
                 await ResendPayloadsAsync();
-                Thread.Sleep((int)_retryPeriod);
+                Thread.Sleep((int) _retryPeriod);
             }
-        }
-
-        public void Stop() {
-            _running = false;
+            // ReSharper disable once FunctionNeverReturns
         }
     }
 }
diff --git a/ld_client/LDClient/network/IApiClient.cs b/ld_client/LDClient/network/IApiClient.cs
index f5ea700..5574d23 100644
--- a/ld_client/LDClient/network/IApiClient.cs
+++ b/ld_client/LDClient/network/IApiClient.cs
@@ -1,9 +1,10 @@
 ﻿using LDClient.network.data;
 
 namespace LDClient.network {
+    
     public interface IApiClient {
+        
         public Task SendPayloadAsync(Payload payload);
         public void Run();
-        public void Stop();
     }
 }
diff --git a/ld_client/LDClient/network/data/Payload.cs b/ld_client/LDClient/network/data/Payload.cs
index 30672d7..57b5755 100644
--- a/ld_client/LDClient/network/data/Payload.cs
+++ b/ld_client/LDClient/network/data/Payload.cs
@@ -8,21 +8,21 @@ namespace LDClient.network.data {
     public class Payload {
 
         [JsonPropertyName("username")]
-        public string UserName { get; set; }
+        public string? UserName { get; set; }
 
         [JsonPropertyName("hostname")]
-        public string HostName { get; set; }
+        public string? HostName { get; set; }
 
         [JsonPropertyName("timestamp")]
         //[Newtonsoft.Json.JsonConverter(typeof(DateFormatConverter), "yyyy-MM-dd HH:mm:ss.ffffff")]
-        public DateTime TimeStamp { get; set; }
+        public string? TimeStamp { get; set; }
 
         [JsonPropertyName("head_device")]
-        public DebuggerInfo HeadDevice { get; set; }
+        public DebuggerInfo? HeadDevice { get; set; }
 
 
         [JsonPropertyName("body_device")]
-        public DebuggerInfo  BodyDevice { get; set; }
+        public DebuggerInfo?  BodyDevice { get; set; }
         
         [JsonPropertyName("status")]
         //[Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
diff --git a/ld_client/LDClient/utils/ConfigLoader.cs b/ld_client/LDClient/utils/ConfigLoader.cs
index b45b9f8..a84708d 100644
--- a/ld_client/LDClient/utils/ConfigLoader.cs
+++ b/ld_client/LDClient/utils/ConfigLoader.cs
@@ -2,44 +2,47 @@
 using Microsoft.Extensions.Configuration;
 
 namespace LDClient.utils {
+    
     internal class ConfigLoader {
+        
         private const string LoggingSection = "Logging";
         private const string NetworkSection = "Network";
         private const string CacheSection = "Cache";
-        private const string DDSection = "DebuggerDetection";
+        private const string DdSection = "DebuggerDetection";
 
         #region Logger
-        public int LogChunkSize { get; set; }
-        public int LogChunkMaxCount { get; set; }
-        public int LogArchiveMaxCount { get; set; }
-
-        public int LogCleanupPeriod { get; set; }
-
-        public LogVerbosity LogVerbosityType { get; set; } = LogVerbosity.Full;
-
-        public LogFlow LogFlowType { get; set; } = LogFlow.Console;
+        
+        public int LogChunkSize { get; private set; }
+        public int LogChunkMaxCount { get; private set; }
+        public int LogArchiveMaxCount { get; private set; }
+
+        public int LogCleanupPeriod { get; private set; }
+        public LogVerbosity LogVerbosityType { get; private set; } = LogVerbosity.Full;
+        public LogFlow LogFlowType { get; private set; } = LogFlow.Console;
+        
         #endregion
 
         #region Api
-        public string ApiBaseAddress { get; set; }
-        public string ApiUsbEndPoint { get; set; }
-        public uint ApiPort { get; set; }
+        
+        public string ApiBaseAddress { get; private set; }
+        public string ApiUsbEndPoint { get; private set; }
+        public uint ApiPort { get; private set; }
 
         #endregion
 
         #region Cache
-        public string CacheFileName { get; set; }
-        public uint MaxRetries { get; set; }
-        public uint MaxEntries { get; set; }
-        public uint RetryPeriod { get; set; }
+        
+        public string CacheFileName { get; private set; }
+        public uint MaxRetries { get; private set; }
+        public uint MaxEntries { get; private set; }
+        public uint RetryPeriod { get; private set; }
+        
         #endregion
 
         #region Detection
-        public string T32Address { get; set; }
-        public int T32Port { get; set; }
-        public string T32ProcessName { get; set; }
-        public uint DetectionPeriod { get; set; }
-        public string T32InfoLocation { get; set; }
+        public string T32ProcessName { get; private set; }
+        public uint DetectionPeriod { get; private set; }
+        public string T32InfoLocation { get; private set; }
         #endregion
 
         public ConfigLoader() {
@@ -49,7 +52,7 @@ namespace LDClient.utils {
             ReadAllSettings(configuration);
         }
 
-        private void ReadAllSettings(IConfigurationRoot configuration) {
+        private void ReadAllSettings(IConfiguration configuration) {
 
             try {
                 var logging = configuration.GetSection(LoggingSection);
@@ -74,9 +77,7 @@ namespace LDClient.utils {
                 CacheFileName = cache["CacheFileName"];
 
 
-                var debugger = configuration.GetSection(DDSection);
-                T32Address = debugger["T32Address"];
-                T32Port = int.Parse(debugger["T32Port"]);
+                var debugger = configuration.GetSection(DdSection);
                 T32ProcessName = debugger["T32ProcessName"];
                 T32InfoLocation = debugger["T32InfoLocation"];
                 DetectionPeriod = uint.Parse(debugger["DetectionPeriod"]);
