Created Packets Library & Test Packet

This commit is contained in:
2021-12-06 15:18:31 +10:00
parent 80febe4206
commit 3f88804156
6 changed files with 132 additions and 0 deletions

View File

@ -36,6 +36,9 @@
<Reference Include="Articulate-Network"> <Reference Include="Articulate-Network">
<HintPath>..\..\Articulate-Network\bin\Debug\Articulate-Network.dll</HintPath> <HintPath>..\..\Articulate-Network\bin\Debug\Articulate-Network.dll</HintPath>
</Reference> </Reference>
<Reference Include="MIT Packets">
<HintPath>..\MIT Packets\bin\Debug\MIT Packets.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />

View File

@ -1,4 +1,6 @@
using Articulate_Network; using Articulate_Network;
using Articulate_Network.Managers;
using MIT_Packets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -11,8 +13,20 @@ namespace MIT_Master_Server
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
TestPacket.Register();
Server server = new Server(); Server server = new Server();
//server.Get<PacketManager>()
var packet = server.Get<PacketManager>().Send<TestPacket>(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 => server.Start("127.0.0.1", 50).ContinueWith(t =>
{ {
Console.WriteLine($"Server listening on port 50"); Console.WriteLine($"Server listening on port 50");

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MIT_Packets</RootNamespace>
<AssemblyName>MIT Packets</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Articulate-Network">
<HintPath>..\..\Articulate-Network\bin\Debug\Articulate-Network.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestPacket.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -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")]

22
MIT Packets/TestPacket.cs Normal file
View File

@ -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()
{
}
}
}

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Builder Client", "MOE B
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Master Server", "MIT Master Server\MIT Master Server.csproj", "{0A8A25AE-69F6-4F10-95E5-20495717FE34}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Master Server", "MIT Master Server\MIT Master Server.csproj", "{0A8A25AE-69F6-4F10-95E5-20495717FE34}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIT Packets", "MIT Packets\MIT Packets.csproj", "{EC6CF112-FDFE-4ACD-98E2-372E0D9ED908}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{0A8A25AE-69F6-4F10-95E5-20495717FE34}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE