From 28242ff052755afb243e55e4da7b167113635239 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 23 Sep 2020 11:50:25 +0200 Subject: [PATCH] added message class and added references to server and client projects --- Client/Client.csproj | 6 +++++- Message/Message.csproj | 12 ++++++++++++ Message/Program.cs | 34 ++++++++++++++++++++++++++++++++++ ProftaakRH/ProftaakRH.sln | 6 ++++++ Server/Server.csproj | 4 ++++ 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 Message/Message.csproj create mode 100644 Message/Program.cs diff --git a/Client/Client.csproj b/Client/Client.csproj index c73e0d1..b664ee3 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -1,8 +1,12 @@ - + Exe netcoreapp3.1 + + + + diff --git a/Message/Message.csproj b/Message/Message.csproj new file mode 100644 index 0000000..0eaee1b --- /dev/null +++ b/Message/Message.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.1 + + + + + + + diff --git a/Message/Program.cs b/Message/Program.cs new file mode 100644 index 0000000..f844f99 --- /dev/null +++ b/Message/Program.cs @@ -0,0 +1,34 @@ +using Newtonsoft.Json; +using System; + +namespace Message +{ + public class Message + { + public string Identifier + { + get;set; + } + + public string Payload + { + get;set; + } + + public Message(string identifier, string payload) + { + this.Identifier = identifier; + this.Payload = payload; + } + + public string Serialize() + { + return JsonConvert.SerializeObject(this); + } + + public static Message Deserialize(string json) + { + return (Message)JsonConvert.DeserializeObject(json); + } + } +} diff --git a/ProftaakRH/ProftaakRH.sln b/ProftaakRH/ProftaakRH.sln index 4ea030c..069a13b 100644 --- a/ProftaakRH/ProftaakRH.sln +++ b/ProftaakRH/ProftaakRH.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "..\Server\Server. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "..\Client\Client.csproj", "{5759DD20-7A4F-4D8D-B986-A70A7818C112}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {5759DD20-7A4F-4D8D-B986-A70A7818C112}.Debug|Any CPU.Build.0 = Debug|Any CPU {5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.ActiveCfg = Release|Any CPU {5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.Build.0 = Release|Any CPU + {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Server/Server.csproj b/Server/Server.csproj index c73e0d1..4c98a00 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -5,4 +5,8 @@ netcoreapp3.1 + + + +