![]() |
VOOZH | about |
dotnet add package ByteSerialization --version 0.0.1-alpha.11
NuGet\Install-Package ByteSerialization -Version 0.0.1-alpha.11
<PackageReference Include="ByteSerialization" Version="0.0.1-alpha.11" />
<PackageVersion Include="ByteSerialization" Version="0.0.1-alpha.11" />Directory.Packages.props
<PackageReference Include="ByteSerialization" />Project file
paket add ByteSerialization --version 0.0.1-alpha.11
#r "nuget: ByteSerialization, 0.0.1-alpha.11"
#:package ByteSerialization@0.0.1-alpha.11
#addin nuget:?package=ByteSerialization&version=0.0.1-alpha.11&prereleaseInstall as a Cake Addin
#tool nuget:?package=ByteSerialization&version=0.0.1-alpha.11&prereleaseInstall as a Cake Tool
A declarative serialization library designed for bit-perfect control over binary representation. You can define C# classes like C structs by assigning attributes to classes and properties. Inspired by BinarySerializer by Jeff Haynes.
This library was created from the ground up to support features like references/pointers.
Notably, this libary is used by swe1r-assets.
Consider the following classes:
public class Manufacturer
{
[Order(0)]
public byte NameLength { get; set; }
[Order(1), Length(nameof(NameLength))]
public char[] Name { get; set; }
}
public class Car
{
[Order(0)]
public byte NameLength { get; set; }
[Order(1), Length(nameof(NameLength))]
public char[] Name { get; set; }
[Order(2), Reference]
public Manufacturer Manufacturer { get; set; }
}
Create an object graph like this:
var mf = new Manufacturer() { NameLength = 2, Name = "MF".ToArray() };
var car = new Car() { NameLength = 4, Name = "Car1".ToArray(), Manufacturer = mf };
using (var ms = new MemoryStream())
{
new ByteSerializer().Serialize(ms, car, Endianness.BigEndian);
File.WriteAllBytes("car.bin", ms.ToArray());
}
That gives you the following binary output:
$ xxd car.bin
00000000: 0443 6172 3100 0000 0902 4d46 .Car1.....MF
| Bytes | Property | Value |
|---|---|---|
| 04 | car.NameLength | 4 |
| 43 61 72 31 | car.Name | "Car1" in ASCII |
| 00 00 00 09 | car.Manufacturer | (pointer to mf) |
| 02 | mf.NameLength | 2 |
| 4d 46 | mf.Name | "MF" in ASCII |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on ByteSerialization:
| Package | Downloads |
|---|---|
|
SWE1R.Assets.Blocks
A library for handling game assets of Star Wars Episode 1 Racer. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-alpha.11 | 135 | 1/27/2025 |
| 0.0.1-alpha.10 | 119 | 7/12/2024 |
| 0.0.1-alpha.9 | 157 | 6/21/2024 |
| 0.0.1-alpha.8 | 147 | 6/20/2024 |
| 0.0.1-alpha.7 | 126 | 6/17/2024 |
| 0.0.1-alpha.6 | 142 | 6/17/2024 |
| 0.0.1-alpha.5 | 134 | 6/4/2024 |
| 0.0.1-alpha.4 | 123 | 6/4/2024 |
| 0.0.1-alpha.3 | 120 | 6/4/2024 |
| 0.0.1-alpha.2 | 140 | 5/31/2024 |
| 0.0.1-alpha.1 | 135 | 5/30/2024 |
| 0.0.1-alpha.0 | 143 | 5/29/2024 |