-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project Sdk="Microsoft.NET.Sdk">
+
<PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{1394E4CA-E17A-42F5-9216-8046ACA8D16B}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Hazel.UnitTests</RootNamespace>
- <AssemblyName>Hazel.UnitTests</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
- <IsCodedUITest>False</IsCodedUITest>
- <TestProjectType>UnitTest</TestProjectType>
- <TargetFrameworkProfile />
+ <TargetFramework>net5.0</TargetFramework>
+ <IsPackable>false</IsPackable>
</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>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <Prefer32Bit>false</Prefer32Bit>
- </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>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
- <HintPath>..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- </ItemGroup>
- <Choose>
- <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
- <ItemGroup>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- </ItemGroup>
- </When>
- <Otherwise>
- <ItemGroup>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
- <Private>False</Private>
- </Reference>
- </ItemGroup>
- </Otherwise>
- </Choose>
- <ItemGroup>
- <Compile Include="BroadcastTests.cs" />
- <Compile Include="Crypto\AesGcmTest.cs" />
- <Compile Include="Crypto\X25519Tests.cs" />
- <Compile Include="Dtls\AesGcmRecordProtectedTests.cs" />
- <Compile Include="Dtls\ConnectionTests.cs" />
- <Compile Include="Dtls\X25519EcdheRsaSha256Tests.cs" />
- <Compile Include="MessageReaderTests.cs" />
- <Compile Include="SocketCapture.cs" />
- <Compile Include="StatisticsTests.cs" />
- <Compile Include="TestHelper.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TestLogger.cs" />
- <Compile Include="UdpConnectionTestHarness.cs" />
- <Compile Include="ThreadLimitedUdpConnectionTests.cs" />
- <Compile Include="UnityUdpConnectionTests.cs" />
- <Compile Include="UdpConnectionTests.cs" />
- <Compile Include="MessageWriterTests.cs" />
- <Compile Include="StressTests.cs" />
- <Compile Include="UdpReliabilityTests.cs" />
- <Compile Include="UPnPTests.cs" />
- <Compile Include="Utils.cs" />
- </ItemGroup>
+
<ItemGroup>
- <ProjectReference Include="..\Hazel\Hazel.csproj">
- <Project>{02cfbd30-d77d-400f-94b2-700f60efdd7f}</Project>
- <Name>Hazel</Name>
- </ProjectReference>
+ <PackageReference Include="Portable.BouncyCastle" Version="1.8.10" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
+ <PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
+ <PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
</ItemGroup>
+
<ItemGroup>
- <None Include="packages.config" />
+ <ProjectReference Include="..\Hazel\Hazel.csproj" />
</ItemGroup>
- <Choose>
- <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
- <ItemGroup>
- <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <Private>False</Private>
- </Reference>
- </ItemGroup>
- </When>
- </Choose>
- <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
+
+</Project>
+++ /dev/null
-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("Hazel.UnitTests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Hazel.UnitTests")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[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("e88c2226-946e-4f00-9336-8d8d7946ac23")]
-
-// 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")]
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hazel.UnitTests", "Hazel.UnitTests\Hazel.UnitTests.csproj", "{1394E4CA-E17A-42F5-9216-8046ACA8D16B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Impostor.Api", "..\Impostor.Api\Impostor.Api.csproj", "{9932ED5B-4B76-451D-84C6-BE060DF1FD20}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{1394E4CA-E17A-42F5-9216-8046ACA8D16B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1394E4CA-E17A-42F5-9216-8046ACA8D16B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1394E4CA-E17A-42F5-9216-8046ACA8D16B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9932ED5B-4B76-451D-84C6-BE060DF1FD20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9932ED5B-4B76-451D-84C6-BE060DF1FD20}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9932ED5B-4B76-451D-84C6-BE060DF1FD20}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9932ED5B-4B76-451D-84C6-BE060DF1FD20}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+<Project Sdk="Microsoft.NET.Sdk">
+
<PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{02CFBD30-D77D-400F-94B2-700F60EFDD7F}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Hazel</RootNamespace>
- <AssemblyName>Hazel</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <TargetFrameworkProfile />
- </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>
- <DocumentationFile>
- </DocumentationFile>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <Prefer32Bit>false</Prefer32Bit>
- <LangVersion>7.3</LangVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>portable</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <DocumentationFile>
- </DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <Prefer32Bit>false</Prefer32Bit>
- <LangVersion>7.3</LangVersion>
- <DebugSymbols>true</DebugSymbols>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugClient|AnyCPU'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\DebugClient\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <LangVersion>7.3</LangVersion>
+ <TargetFramework>net5.0</TargetFramework>
+ <DefineConstants>HAZEL_BAG</DefineConstants>
</PropertyGroup>
+
+ <ItemGroup>
+ <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
+ <_Parameter1>Hazel.UnitTests</_Parameter1>
+ </AssemblyAttribute>
+ </ItemGroup>
+
<ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
+ <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.0" />
+ <PackageReference Include="Serilog" Version="2.10.0" />
</ItemGroup>
+
<ItemGroup>
- <Compile Include="ByteSpan.cs" />
- <Compile Include="ByteSpanExtensions.cs" />
- <Compile Include="Connection.cs" />
- <Compile Include="ConnectionListener.cs" />
- <Compile Include="ConnectionState.cs" />
- <Compile Include="Crypto\AesGcm.cs" />
- <Compile Include="Crypto\Const.cs" />
- <Compile Include="Crypto\SpanCryptoExtensions.cs" />
- <Compile Include="Crypto\X25519.cs" />
- <Compile Include="DataReceivedEventArgs.cs" />
- <Compile Include="DisconnectedEventArgs.cs" />
- <Compile Include="Dtls\AesGcmRecordProtection.cs" />
- <Compile Include="Dtls\DtlsUnityConnection.cs" />
- <Compile Include="Dtls\DtlsConnectionListener.cs" />
- <Compile Include="Dtls\Handshake.cs" />
- <Compile Include="Dtls\IHandshakeCipherSuite.cs" />
- <Compile Include="Dtls\IRecordProtection.cs" />
- <Compile Include="Dtls\NullRecordProtection.cs" />
- <Compile Include="Dtls\PrfSha256.cs" />
- <Compile Include="Dtls\Record.cs" />
- <Compile Include="Dtls\X25519EcdheRsaSha256.cs" />
- <Compile Include="FewerThreads\HazelThreadPool.cs" />
- <Compile Include="FewerThreads\ThreadLimitedUdpConnectionListener.cs" />
- <Compile Include="FewerThreads\ThreadLimitedUdpServerConnection.cs" />
- <Compile Include="HazelException.cs" />
- <Compile Include="IPMode.cs" />
- <Compile Include="IRecyclable.cs" />
- <Compile Include="MessageReader.cs" />
- <Compile Include="NetworkConnection.cs" />
- <Compile Include="NetworkConnectionListener.cs" />
- <Compile Include="MessageWriter.cs" />
- <Compile Include="NewConnectionEventArgs.cs" />
- <Compile Include="ObjectPool.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SendOption.cs" />
- <Compile Include="Udp\SendOptionInternal.cs" />
- <Compile Include="ConnectionStatistics.cs" />
- <Compile Include="Udp\UdpBroadcaster.cs" />
- <Compile Include="Udp\UdpBroadcastListener.cs" />
- <Compile Include="Udp\UnityUdpClientConnection.cs" />
- <Compile Include="Udp\UdpClientConnection.cs" />
- <Compile Include="Udp\UdpConnection.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Udp\UdpConnection.KeepAlive.cs" />
- <Compile Include="Udp\UdpConnection.Reliable.cs" />
- <Compile Include="Udp\UdpConnectionListener.cs" />
- <Compile Include="Udp\UdpServerConnection.cs" />
- <Compile Include="UPnP\ILogger.cs" />
- <Compile Include="UPnP\NetUtility.cs" />
- <Compile Include="UPnP\UPnPHelper.cs" />
+ <ProjectReference Include="..\..\Impostor.Api\Impostor.Api.csproj" />
</ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
+
+</Project>
+++ /dev/null
-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("Hazel")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Hazel")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
-[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("f3935f38-a904-40c7-ab9b-8d01aefe0489")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.1.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-
-// Show internals to unit testing assembly so it can test
-[assembly:InternalsVisibleTo("Hazel.UnitTests")]
\ No newline at end of file
-#### Hazel Networking is a low-level networking library for C# providing connection-oriented, message based communication via UDP and RUDP.
+# Impostor.Hazel
-The aim of this fork is to create a simple interface for ultra-fast connection-based UDP communication for games.
-
------
-
-## Features
-- UDP and Reliable UDP.
-- UDP Broadcast for local-multiplayer.
-- Completely thread safe.
-- All protocols are connection oriented (similar to TCP) and message based (similar to UDP)
-- IPv4 and IPv6 support
-- Automatic statistics about data passing in and out of connections
-- Designed to be as fast and leightweight as possible
-
------
-
-### This fork has been heavily modified from the original to reduce allocations, copies, and locking. As such, it's fairly stable, but not guaranteed. However, my game Among Us currently runs on it with over 500k MAU, so that counts for something.
-
------
-
-HTML documentation, tutorials and quickstarts from the DarkRift Website [here](http://www.darkriftnetworking.com/Hazel/Docs) should be relatively accurate; but I doubt the original creator will want support calls for this fork. I can provide some limited support if you create an issue.
-
-I have changed some interfaces in "non-intuitive ways", it is my hope that [this example repo](https://github.com/willardf/Hazel-Examples) will be able to help users get started.
-
-If you want to make improvements, I am open to pull requests. If you find bugs, feel free raise issues.
-
------
-
-## Building Hazel
-
-To build Hazel open [solution file](Hazel.sln) using your favourite C# IDE (I use Visual Studio 2017) and then build as you would any other project.
-
------
-
-## Tips for using Hazel with Unity
-
- * Unity doesn't like other threads messing with GameObjects. This isn't a problem for tasks like relaying information. But for tasks like spawning GameObjects on clients or correcting physics, you will want to have a thread safe list of events that are run and cleared during Update or FixedUpdate.
- * A List<T>+lock(object) is fine because you have many writers, one reader and Hazel doesn't guarantee event order.
- * A ConcurrentBag is not a bad choice, but you will have to do something special to keep the Update method from hanging if you get an overwhelming number of new events (which suggests problems with your code elsewhere).
- * I also recommend using the ConnectAsync method in a Coroutine that waits for State to change so you don't hang the game while connecting.
+Fork of Hazel made for [Impostor](https://github.com/Impostor/Impostor)