From b557174ef94b3101bd8b460f96cda49dcb288a76 Mon Sep 17 00:00:00 2001 From: "Chris.Watts90@outlook.com" Date: Thu, 31 May 2018 14:08:41 +0100 Subject: [PATCH] set .net versions to .net 4.5 for interfaces, ConfigurationHandler, CardReaderService projects in order to target mono framework. update ninject to 3.3.1 to attempt compatibility with mono framework. switch ninject config to use logfile logger not nlog..for now.. --- .../CardReaderService/App.config | 18 ++- .../CardReaderService.csproj | 4 +- .../DefaultComponents/LogFileLogger.cs | 122 ++++++++++++++++++ .../CardReaderService/NinjectConfig.xml | 2 +- .../CardReaderService/packages.config | 8 +- .../CardReaderServiceHost/App.config | 14 +- .../ConfigurationHandler.csproj | 3 +- .../Interfaces/Interfaces.csproj | 3 +- .../WindowsDataCenter/App.config | 18 ++- .../WindowsDataCenter/packages.config | 20 +-- .../WindowsDataServiceHost/App.config | 14 +- 11 files changed, 197 insertions(+), 29 deletions(-) create mode 100644 DataCenter_Windows/WindowsDataCenter/CardReaderService/DefaultComponents/LogFileLogger.cs diff --git a/DataCenter_Windows/WindowsDataCenter/CardReaderService/App.config b/DataCenter_Windows/WindowsDataCenter/CardReaderService/App.config index a1f8f1f..ed0e97f 100644 --- a/DataCenter_Windows/WindowsDataCenter/CardReaderService/App.config +++ b/DataCenter_Windows/WindowsDataCenter/CardReaderService/App.config @@ -1,10 +1,18 @@ - + - + - - + + - \ No newline at end of file + + + + + + + + + diff --git a/DataCenter_Windows/WindowsDataCenter/CardReaderService/CardReaderService.csproj b/DataCenter_Windows/WindowsDataCenter/CardReaderService/CardReaderService.csproj index 2f275a1..9ce3d75 100644 --- a/DataCenter_Windows/WindowsDataCenter/CardReaderService/CardReaderService.csproj +++ b/DataCenter_Windows/WindowsDataCenter/CardReaderService/CardReaderService.csproj @@ -9,9 +9,10 @@ Properties CardReaderService CardReaderService - v4.5.2 + v4.5 512 true + AnyCPU @@ -85,6 +86,7 @@ + Component diff --git a/DataCenter_Windows/WindowsDataCenter/CardReaderService/DefaultComponents/LogFileLogger.cs b/DataCenter_Windows/WindowsDataCenter/CardReaderService/DefaultComponents/LogFileLogger.cs new file mode 100644 index 0000000..2a12080 --- /dev/null +++ b/DataCenter_Windows/WindowsDataCenter/CardReaderService/DefaultComponents/LogFileLogger.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Interfaces; + +namespace CardReaderService.DefaultComponents +{ + class LogFileLogger: ILogger + { + public bool IsDebugEnabled => true; + public bool IsErrorEnabled => true; + public bool IsFatalEnabled => true; + public bool IsInfoEnabled => true; + public bool IsTraceEnabled => true; + public bool IsWarnEnabled => true; + + public void Debug(Exception exception) + { + Log(exception.ToString()); + } + + public void Debug(string format, params object[] args) + { + Log(string.Format(format, args)); + } + + public void Debug(Exception exception, string format, params object[] args) + { + Log(exception.ToString()); + Log(string.Format(format, args)); + } + + public void Error(Exception exception) + { + Log(exception.ToString()); + } + + public void Error(string format, params object[] args) + { + Log(string.Format(format, args)); + } + + public void Error(Exception exception, string format, params object[] args) + { + Log(exception.ToString()); + Log(string.Format(format, args)); + } + + public void Fatal(Exception exception) + { + Log(exception.ToString()); + } + + public void Fatal(string format, params object[] args) + { + Log(string.Format(format, args)); + } + + public void Fatal(Exception exception, string format, params object[] args) + { + Log(exception.ToString()); + Log(string.Format(format, args)); + } + + public void Info(Exception exception) + { + Log(exception.ToString()); + } + + public void Info(string format, params object[] args) + { + Log(string.Format(format, args)); + } + + public void Info(Exception exception, string format, params object[] args) + { + Log(exception.ToString()); + Log(string.Format(format, args)); + } + + public void Trace(Exception exception) + { + Log(exception.ToString()); + } + + public void Trace(string format, params object[] args) + { + Log(string.Format(format, args)); + } + + public void Trace(Exception exception, string format, params object[] args) + { + Log(exception.ToString()); + Log(string.Format(format, args)); + } + + public void Warn(Exception exception) + { + Log(exception.ToString()); + } + + public void Warn(string format, params object[] args) + { + Log(string.Format(format, args)); + } + + public void Warn(Exception exception, string format, params object[] args) + { + Log(exception.ToString()); + Log(string.Format(format, args)); + } + + private static string _logPath = "log.txt"; + + public static void Log(string message) + { + System.IO.File.WriteAllText(_logPath, string.Format("{0} | {1}", DateTime.Now, message)); + } + } +} diff --git a/DataCenter_Windows/WindowsDataCenter/CardReaderService/NinjectConfig.xml b/DataCenter_Windows/WindowsDataCenter/CardReaderService/NinjectConfig.xml index 71ad73d..e9e7cb1 100644 --- a/DataCenter_Windows/WindowsDataCenter/CardReaderService/NinjectConfig.xml +++ b/DataCenter_Windows/WindowsDataCenter/CardReaderService/NinjectConfig.xml @@ -1,5 +1,5 @@  + to="CardReaderService.DefaultComponents.LogFileLogger, CardReaderService" scope="singleton" /> \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/CardReaderService/packages.config b/DataCenter_Windows/WindowsDataCenter/CardReaderService/packages.config index 4bf2383..ac42eb0 100644 --- a/DataCenter_Windows/WindowsDataCenter/CardReaderService/packages.config +++ b/DataCenter_Windows/WindowsDataCenter/CardReaderService/packages.config @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/CardReaderServiceHost/App.config b/DataCenter_Windows/WindowsDataCenter/CardReaderServiceHost/App.config index 6fda695..ed16304 100644 --- a/DataCenter_Windows/WindowsDataCenter/CardReaderServiceHost/App.config +++ b/DataCenter_Windows/WindowsDataCenter/CardReaderServiceHost/App.config @@ -1,10 +1,18 @@ - + - - + + + + + + + + + + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/ConfigurationHandler/ConfigurationHandler.csproj b/DataCenter_Windows/WindowsDataCenter/ConfigurationHandler/ConfigurationHandler.csproj index 461434d..456c1dc 100644 --- a/DataCenter_Windows/WindowsDataCenter/ConfigurationHandler/ConfigurationHandler.csproj +++ b/DataCenter_Windows/WindowsDataCenter/ConfigurationHandler/ConfigurationHandler.csproj @@ -9,8 +9,9 @@ Properties ConfigurationHandler ConfigurationHandler - v4.5.2 + v4.5 512 + true diff --git a/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj b/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj index 2a53dee..84f5ae8 100644 --- a/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj +++ b/DataCenter_Windows/WindowsDataCenter/Interfaces/Interfaces.csproj @@ -9,8 +9,9 @@ Properties Interfaces Interfaces - v4.5.2 + v4.5 512 + true diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config index 7d38816..0dd4b37 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config @@ -3,9 +3,9 @@ - + - + @@ -18,7 +18,7 @@ - + @@ -36,6 +36,18 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config index 0363aa3..1535601 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config @@ -1,5 +1,6 @@  + @@ -8,21 +9,22 @@ - + - - - - - - - - + + + + + + + + + diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config index d2ebb4c..2677a94 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config @@ -4,7 +4,7 @@ - + @@ -31,6 +31,18 @@ + + + + + + + + + + + + \ No newline at end of file