Ceiralizer 3.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Ceiralizer --version 3.0.0
NuGet\Install-Package Ceiralizer -Version 3.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ceiralizer" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ceiralizer" Version="3.0.0" />
<PackageReference Include="Ceiralizer" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ceiralizer --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ceiralizer, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ceiralizer@3.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ceiralizer&version=3.0.0
#tool nuget:?package=Ceiralizer&version=3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ceiralizer
Serialize structs and classes to a byte array and deserialize them back.
NuGet: https://www.nuget.org/packages/Ceiralizer
Quick Start
1. Define Your Packet
public struct CeiraPacket : IPacket
{
[PacketField] public short Op;
// Fields without PacketField are ignored.
public string Garbage;
[PacketField] public int Value;
[PacketField] public int[] Ceiras;
[PacketField] public char Prefix;
[PacketField] public CeirinhaPacket Ceirinha;
[PacketField] public string Name;
[PacketField] public bool IsWorking;
[PacketField] public Vector2 Position;
[PacketField] public Ceirax Ceirax;
public struct CeirinhaPacket : IPacket
{
[PacketField] public string Ceirinha;
}
public struct Vector2 : ISerializable { public int X; public int Y;
public void Serialize(ChunkWriter writer)
{
Serializers.SerializeInt(X, writer);
Serializers.SerializeInt(Y, writer);
}
public void Deserialize(ChunkReader reader)
{
X = Serializers.DeserializeInt(reader);
Y = Serializers.DeserializeInt(reader);
}
}
### Transforming
```csharp
using System.Text;
using Ceiralizer;
// Default is Encoding.Unicode. Use UTF-8 to reduce the size for most text data.
CeiralizerConfig.StringEncoder = Encoding.UTF8;
3. Serialize & Deserialize
// Serialize
byte[] data = PacketSerializer.Serialize(new CeiraPacket
{
Op = 2,
Value = 255,
Ceiras = new[] { 4, 66, 95 },
Garbage = "Lixo",
Prefix = 'c',
Ceirinha = new CeirinhaPacket { Ceirinha = "Ceira purinha" },
Name = "Ceira",
IsWorking = true,
Position = new Vector2(5, 25),
Ceirax = new Ceirax { Title = "Test", Description = "Test", Price = 10.5f }
});
// Deserialize
CeiraPacket packet = PacketSerializer.Deserialize<CeiraPacket>(data);
Console.WriteLine(packet.Op); // Output: 2
Console.WriteLine(packet.Value); // Output: 255
Console.WriteLine(packet.Name); // Output: Ceira
Console.WriteLine(packet.IsWorking); // Output: True
Supported Types
- Primitives:
bool,byte,sbyte,char - Integer:
int,uint,short,ushort,long,ulong - Float:
float,double - Text:
string - Collections: Arrays of any supported type
- Nested Packets: Any type implementing
IPacket - Custom Types: Any type implementing
ISerializable
Custom Serialization
Implement ISerializable for complex types:
public class Ceirax : ISerializable
{
public string Title = "";
public string Description = "";
public float Price;
public void Serialize(ChunkWriter writer)
{
Serializers.SerializeString(Title, writer);
Serializers.SerializeString(Description, writer);
Serializers.SerializeFloat(Price, writer);
}
public void Deserialize(ChunkReader reader)
{
Title = Serializers.DeserializeString(reader);
Description = Serializers.DeserializeString(reader);
Price = Serializers.DeserializeFloat(reader);
}
}
Note: Mark
ISerializablefields with[PacketField]in your packet definition.
How It Works
Ceiralizer serializes fields in declaration order:
- Size prefix: Arrays and strings store their byte/element count first
- Sequential writing: Each
[PacketField]is written as-is to the byte stream - Nested packets:
IPacketimplementations are flattened (fields merged) - Custom logic:
ISerializabletypes use their custom Serialize/Deserialize methods
Example byte structure for a short and an int:
[short: 2] [int: 255]
00000010 00000000 | 11111111 00000000 00000000 00000000
| 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 was computed. 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.1.0 | 171 | 5/26/2026 |
| 4.0.1 | 159 | 5/25/2026 |
| 4.0.0 | 156 | 5/25/2026 |
| 3.2.0 | 157 | 5/23/2026 |
| 3.1.2 | 158 | 5/23/2026 |
| 3.1.1 | 155 | 5/22/2026 |
| 3.1.0 | 150 | 5/20/2026 |
| 3.0.0 | 151 | 5/14/2026 |
| 2.0.0 | 2,509 | 5/8/2026 |
| 1.1.0 | 6,638 | 1/31/2023 |
| 1.0.5 | 6,781 | 4/12/2022 |
| 1.0.4 | 6,772 | 4/10/2022 |
| 1.0.3 | 6,735 | 4/6/2022 |
| 1.0.2 | 6,736 | 2/10/2022 |
| 1.0.1 | 6,745 | 2/7/2022 |
| 1.0.0 | 6,573 | 1/7/2022 |