NetSquare.Core
1.0.6
See the version list below for details.
dotnet add package NetSquare.Core --version 1.0.6
NuGet\Install-Package NetSquare.Core -Version 1.0.6
<PackageReference Include="NetSquare.Core" Version="1.0.6" />
<PackageVersion Include="NetSquare.Core" Version="1.0.6" />
<PackageReference Include="NetSquare.Core" />
paket add NetSquare.Core --version 1.0.6
#r "nuget: NetSquare.Core, 1.0.6"
#:package NetSquare.Core@1.0.6
#addin nuget:?package=NetSquare.Core&version=1.0.6
#tool nuget:?package=NetSquare.Core&version=1.0.6
NetSquare.Core
NetSquare.Core contains the shared primitives used by NetSquare.Client and NetSquare.Server: network messages, serialization helpers, dispatcher routing, compression and encryption abstractions, protocol helpers, UDP client support, and synchronization frames.
The package targets .NET Standard 2.0, .NET 8, and .NET Framework 4.8. It is installed automatically when you install NetSquare.Client or NetSquare.Server 1.0.6 and later.
Installation
NuGet\Install-Package NetSquare.Core -Version 1.0.6
or:
dotnet add package NetSquare.Core --version 1.0.6
Network Messages
Use NetworkMessage to write values in the order the receiver will read them.
using NetSquare.Core;
public enum GameMessage : ushort
{
Chat = 1,
Ping = 2
}
NetworkMessage message = new NetworkMessage(GameMessage.Chat)
.Set("hello")
.Set(123)
.Set(true);
string text = message.Serializer.GetString();
int number = message.Serializer.GetInt();
bool enabled = message.Serializer.GetBool();
Supported helpers include numeric primitives, strings, chars, booleans, byte arrays, numeric arrays, INetSquareSerializable objects, lists, and dictionaries.
Dispatcher
Register handlers manually:
NetSquareDispatcher dispatcher = new NetSquareDispatcher();
dispatcher.AddHeadAction(GameMessage.Chat, "Chat", message =>
{
string text = message.Serializer.GetString();
});
Or auto-bind public static methods with NetSquareActionAttribute:
public static class Handlers
{
[NetSquareAction(GameMessage.Chat)]
public static void OnChat(NetworkMessage message)
{
string text = message.Serializer.GetString();
}
}
Serialization
Implement INetSquareSerializable when a type should control its own binary representation.
public sealed class PlayerState : INetSquareSerializable
{
public string Name;
public int Score;
public void Serialize(NetSquareSerializer serializer)
{
serializer.Set(Name);
serializer.Set(Score);
}
public void Deserialize(NetSquareSerializer serializer)
{
Name = serializer.GetString();
Score = serializer.GetInt();
}
}
Compression and Encryption
NetSquare.Core includes reusable compression and encryption implementations such as NoCompression, GZipCompressor, DeflateCompressor, NoEncryption, AES_Encryptor, and XOR_Encryptor.
Synchronization Frames
The synchronization frame types are shared by the client and server world managers.
INetSquareSynchFrame frame = new NetsquareTransformFrame(
_x: 10,
_y: 0,
_z: 5,
_time: 1.25f);
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- System.Threading.Tasks.Extensions (>= 4.4.0)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on NetSquare.Core:
| Package | Downloads |
|---|---|
|
NetSquare.Server
NetSquare as a verry fast and easy to use .NET Tcp/Udp solution for Server/client developpment. Unity compatible |
|
|
NetSquare.Client
NetSquare as a verry fast and easy to use .NET Tcp/Udp solution for Server/client developpment. Unity compatible |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial standalone core package split from NetSquare.Client and NetSquare.Server.