From 3f88804156d4ae0c72a824a1ee6c872a55b0ac52 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 6 Dec 2021 15:18:31 +1000 Subject: [PATCH] Created Packets Library & Test Packet --- MIT Master Server/MIT Master Server.csproj | 3 ++ MIT Master Server/Program.cs | 14 ++++++ MIT Packets/MIT Packets.csproj | 51 ++++++++++++++++++++++ MIT Packets/Properties/AssemblyInfo.cs | 36 +++++++++++++++ MIT Packets/TestPacket.cs | 22 ++++++++++ Mass Imaging Tool.sln | 6 +++ 6 files changed, 132 insertions(+) create mode 100644 MIT Packets/MIT Packets.csproj create mode 100644 MIT Packets/Properties/AssemblyInfo.cs create mode 100644 MIT Packets/TestPacket.cs diff --git a/MIT Master Server/MIT Master Server.csproj b/MIT Master Server/MIT Master Server.csproj index c76fb80..ee363ac 100644 --- a/MIT Master Server/MIT Master Server.csproj +++ b/MIT Master Server/MIT Master Server.csproj @@ -36,6 +36,9 @@ ..\..\Articulate-Network\bin\Debug\Articulate-Network.dll + + ..\MIT Packets\bin\Debug\MIT Packets.dll + diff --git a/MIT Master Server/Program.cs b/MIT Master Server/Program.cs index 5f8c45c..7f03deb 100644 --- a/MIT Master Server/Program.cs +++ b/MIT Master Server/Program.cs @@ -1,4 +1,6 @@ using Articulate_Network; +using Articulate_Network.Managers; +using MIT_Packets; using System; using System.Collections.Generic; using System.Linq; @@ -11,8 +13,20 @@ namespace MIT_Master_Server { static void Main(string[] args) { + TestPacket.Register(); + Server server = new Server(); + //server.Get() + var packet = server.Get().Send(new TestPacket() + { + TestOne = 50, + TestTwo = true, + TestThree = "Hello I'm a test" + }); + + Console.WriteLine(packet.TestThree); + server.Start("127.0.0.1", 50).ContinueWith(t => { Console.WriteLine($"Server listening on port 50"); diff --git a/MIT Packets/MIT Packets.csproj b/MIT Packets/MIT Packets.csproj new file mode 100644 index 0000000..53a86eb --- /dev/null +++ b/MIT Packets/MIT Packets.csproj @@ -0,0 +1,51 @@ + + + + + Debug + AnyCPU + {EC6CF112-FDFE-4ACD-98E2-372E0D9ED908} + Library + Properties + MIT_Packets + MIT Packets + v4.6 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\Articulate-Network\bin\Debug\Articulate-Network.dll + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MIT Packets/Properties/AssemblyInfo.cs b/MIT Packets/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ec6a5a0 --- /dev/null +++ b/MIT Packets/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("MIT Packets")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Queensland Government")] +[assembly: AssemblyProduct("MIT Packets")] +[assembly: AssemblyCopyright("Copyright © Queensland Government 2021")] +[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("ec6cf112-fdfe-4acd-98e2-372e0d9ed908")] + +// 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")] diff --git a/MIT Packets/TestPacket.cs b/MIT Packets/TestPacket.cs new file mode 100644 index 0000000..b862ba9 --- /dev/null +++ b/MIT Packets/TestPacket.cs @@ -0,0 +1,22 @@ +using Articulate_Network.Attributes; +using Articulate_Network.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MIT_Packets +{ + public class TestPacket : IPacket + { + public int TestOne { get; set; } + [PacketIgnore] + public bool TestTwo { get; set; } + public string TestThree { get; set; } + public static void Register() + { + + } + } +} diff --git a/Mass Imaging Tool.sln b/Mass Imaging Tool.sln index d5a704a..8ccc251 100644 --- a/Mass Imaging Tool.sln +++ b/Mass Imaging Tool.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Builder Client", "MOE B EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Master Server", "MIT Master Server\MIT Master Server.csproj", "{0A8A25AE-69F6-4F10-95E5-20495717FE34}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Packets", "MIT Packets\MIT Packets.csproj", "{EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {0A8A25AE-69F6-4F10-95E5-20495717FE34}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A8A25AE-69F6-4F10-95E5-20495717FE34}.Release|Any CPU.ActiveCfg = Release|Any CPU {0A8A25AE-69F6-4F10-95E5-20495717FE34}.Release|Any CPU.Build.0 = Release|Any CPU + {EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE