From 315580ec654b6dd4f8eef885ab44c2fb96595729 Mon Sep 17 00:00:00 2001 From: "Chris.Watts90@outlook.com" Date: Thu, 30 Mar 2017 16:53:36 +0100 Subject: [PATCH 01/42] add logger project. --- .../CardReaderService/CardReaderService.sln | 6 ++ CardReaderService/Logger/Logger.csproj | 55 +++++++++++++++++++ CardReaderService/Logger/MessageLogger.cs | 19 +++++++ .../Logger/Properties/AssemblyInfo.cs | 36 ++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 CardReaderService/Logger/Logger.csproj create mode 100644 CardReaderService/Logger/MessageLogger.cs create mode 100644 CardReaderService/Logger/Properties/AssemblyInfo.cs diff --git a/CardReaderService/CardReaderService/CardReaderService.sln b/CardReaderService/CardReaderService/CardReaderService.sln index 61dbd08..301c665 100644 --- a/CardReaderService/CardReaderService/CardReaderService.sln +++ b/CardReaderService/CardReaderService/CardReaderService.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardReaderService", "CardRe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardReaderServiceHost", "..\CardReaderServiceHost\CardReaderServiceHost.csproj", "{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logger", "..\Logger\Logger.csproj", "{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Debug|Any CPU.Build.0 = Debug|Any CPU {6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Release|Any CPU.ActiveCfg = Release|Any CPU {6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Release|Any CPU.Build.0 = Release|Any CPU + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CardReaderService/Logger/Logger.csproj b/CardReaderService/Logger/Logger.csproj new file mode 100644 index 0000000..9ee3507 --- /dev/null +++ b/CardReaderService/Logger/Logger.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02} + Library + Properties + Logger + Logger + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CardReaderService/Logger/MessageLogger.cs b/CardReaderService/Logger/MessageLogger.cs new file mode 100644 index 0000000..3659624 --- /dev/null +++ b/CardReaderService/Logger/MessageLogger.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Logger +{ + public class MessageLogger + { + 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/CardReaderService/Logger/Properties/AssemblyInfo.cs b/CardReaderService/Logger/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3ae09c3 --- /dev/null +++ b/CardReaderService/Logger/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Logger")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Logger")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("42efe386-dc2e-455a-ba81-5fc9cee45d02")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] From 0f3eb1d46b1f1db416fa3a55c613ed71797858a3 Mon Sep 17 00:00:00 2001 From: "Chris.Watts90@outlook.com" Date: Thu, 30 Mar 2017 16:54:54 +0100 Subject: [PATCH 02/42] retarget for .net 4.5 (from 4.5.2) for mono support. reference logger. add calls to logger to help trace the service on start/stop. --- CardReaderService/CardReaderService/App.config | 6 +++--- .../CardReaderService/CardReaderService.csproj | 9 ++++++++- CardReaderService/CardReaderService/Service1.cs | 4 ++++ CardReaderService/CardReaderServiceHost/App.config | 6 +++--- .../CardReaderServiceHost/CardReaderServiceHost.csproj | 3 ++- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CardReaderService/CardReaderService/App.config b/CardReaderService/CardReaderService/App.config index da9bca9..89c3fd7 100644 --- a/CardReaderService/CardReaderService/App.config +++ b/CardReaderService/CardReaderService/App.config @@ -1,9 +1,9 @@ - + - + - \ No newline at end of file + diff --git a/CardReaderService/CardReaderService/CardReaderService.csproj b/CardReaderService/CardReaderService/CardReaderService.csproj index 2b37206..ba02ba8 100644 --- a/CardReaderService/CardReaderService/CardReaderService.csproj +++ b/CardReaderService/CardReaderService/CardReaderService.csproj @@ -9,9 +9,10 @@ Properties CardReaderService CardReaderService - v4.5.2 + v4.5 512 true + AnyCPU @@ -68,6 +69,12 @@ + + + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02} + Logger + + + \ No newline at end of file diff --git a/CardReaderService/Logger/MessageLogger.cs b/CardReaderService/Logger/MessageLogger.cs new file mode 100644 index 0000000..3659624 --- /dev/null +++ b/CardReaderService/Logger/MessageLogger.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Logger +{ + public class MessageLogger + { + 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/CardReaderService/Logger/Properties/AssemblyInfo.cs b/CardReaderService/Logger/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3ae09c3 --- /dev/null +++ b/CardReaderService/Logger/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Logger")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Logger")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("42efe386-dc2e-455a-ba81-5fc9cee45d02")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] From d55ee663b8ca577e0c6e0ebe78dba135cf006052 Mon Sep 17 00:00:00 2001 From: "Chris.Watts90@outlook.com" Date: Thu, 30 Mar 2017 16:54:54 +0100 Subject: [PATCH 06/42] retarget for .net 4.5 (from 4.5.2) for mono support. reference logger. add calls to logger to help trace the service on start/stop. --- .../CardReaderService/App.config | 6 ++--- .../CardReaderService.csproj | 9 +++++++- .../CardReaderService/Service1.cs | 22 +++++++++++++++++++ .../CardReaderServiceHost/App.config | 6 ++--- .../CardReaderServiceHost.csproj | 3 ++- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/CardReaderService/CardReaderService/App.config b/CardReaderService/CardReaderService/App.config index da9bca9..89c3fd7 100644 --- a/CardReaderService/CardReaderService/App.config +++ b/CardReaderService/CardReaderService/App.config @@ -1,9 +1,9 @@ - + - + - \ No newline at end of file + diff --git a/CardReaderService/CardReaderService/CardReaderService.csproj b/CardReaderService/CardReaderService/CardReaderService.csproj index 2b37206..ba02ba8 100644 --- a/CardReaderService/CardReaderService/CardReaderService.csproj +++ b/CardReaderService/CardReaderService/CardReaderService.csproj @@ -9,9 +9,10 @@ Properties CardReaderService CardReaderService - v4.5.2 + v4.5 512 true + AnyCPU @@ -68,6 +69,12 @@ + + + {42EFE386-DC2E-455A-BA81-5FC9CEE45D02} + Logger + + diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.js b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.js index 71b08ad..d44f266 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.js +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.js @@ -5,7 +5,7 @@ self.unassignedCardList = ko.observable(null); self.helpers = new Helpers(); self.policyMarkdown = ""; - self.previewHtml = ko.observable(""); + self.policyData = ko.observable({ChangeAuthor:"", ChangeDate:moment(), Version:1, ChangeDescription:"", Markdown:"", Html:""}); self.renderer = new marked.Renderer(); self.renderer.blockquote = function(quote) { return "
" + quote + "
"; @@ -66,7 +66,7 @@ }); self.editor.codemirror.on("changes", function () { - self.previewHtml(self.editor.options.previewRender(self.editor.value())); + self.policyData().Html=self.editor.options.previewRender(self.editor.value()); }); self.uiPages = { overview: "overview", @@ -168,9 +168,9 @@ }; self.policySave = function () { var url = self.helpers.createRequestUrl(self.apiEndpoints.savePolicy, null, false); - var policy = { markdown: self.editor.value(), html: self.previewHtml() }; - console.log(policy); - $.post(url, policy, function() { + self.policyData().Markdown = self.editor.value(); //make sure we update it, as it doesnt push the value back into the variable + console.log(self.policyData()); + $.post(url, self.policyData(), function() { }, "json") .done(function() { self.policyReload(); @@ -185,7 +185,7 @@ $.getJSON(url, function (res) { console.log(res); self.editor.value(res.Markdown); - self.previewHtml(res.Html); + self.policyData(res); }).fail(function (resp, status, error) { console.log("error - policyReload"); var errObj = self.helpers.processRequestFailure(resp, status, error); diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.min.js b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.min.js index 83413e6..80c0157 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.min.js +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/admin.min.js @@ -1 +1 @@ -function AdminVM(){var n=this;n.groupsList=ko.observable(null);n.groupEditItem=ko.observable(null);n.unassignedCardList=ko.observable(null);n.helpers=new Helpers;n.policyMarkdown="";n.previewHtml=ko.observable("");n.renderer=new marked.Renderer;n.renderer.blockquote=function(n){return'
'+n+"<\/blockquote>"};n.renderer.heading=function(n,t){var r=new Tautologistics.NodeHtmlParser.DefaultHandler(function(t){if(t)throw new Error('Cannot parse "'+n+'" in markdown file.');}),u=new Tautologistics.NodeHtmlParser.Parser(r),i;return u.parseComplete(n),i="unknown",r.dom.length>0&&(i=r.dom[0].raw.toLowerCase().trim().replace(/ /g,"-")),"