Prowl.Echo 1.0.2

dotnet add package Prowl.Echo --version 1.0.2                
NuGet\Install-Package Prowl.Echo -Version 1.0.2                
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="Prowl.Echo" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Prowl.Echo --version 1.0.2                
#r "nuget: Prowl.Echo, 1.0.2"                
#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.
// Install Prowl.Echo as a Cake Addin
#addin nuget:?package=Prowl.Echo&version=1.0.2

// Install Prowl.Echo as a Cake Tool
#tool nuget:?package=Prowl.Echo&version=1.0.2                

Prowl.Echo Serializer

A lightweight, flexible serialization system (Built for the Prowl Game Engine). The serializer supports complex object graphs, circular references, and custom serialization behaviors.

Echo does what the name suggests, and create an "Echo" an intermediate representation of the target object. This allows for fast inspection and modification before converting to Binary or Text.

Features

  • Type Support

    • Primitives (int, float, double, string, bool, etc.)
    • Complex objects and nested types
    • Collections (List, Array, HashSet)
    • Dictionaries
    • Enums
    • DateTime and Guid
    • Nullable types
    • Circular references
    • Multi-dimensional and jagged arrays
    • Support for custom serializable objects
  • Flexible Serialization Control

    • Custom serialization through ISerializable interface
    • Attribute-based control ([FormerlySerializedAs], [IgnoreOnNull])
    • Support for legacy data through attribute mapping
  • Misc

    • Battle Tested in the Prowl Game Engine
    • Supports both String & Binary formats
    • Mimics Unity's Serializer

Usage

Basic Serialization

// Serialize an object
var myObject = new MyClass { Value = 42 };
var serialized = Serializer.Serialize(myObject);

// Deserialize back
var deserialized = Serializer.Deserialize<MyClass>(serialized);

Serializating to Text

var serialized = Serializer.Serialize(myObject);

// Save to Text
string text = StringTagConverter.Write(serialized);

// Read to From
var fromText = StringTagConverter.Read(text);

var deserialized = Serializer.Deserialize<MyClass>(fromText);

Custom Serialization

public class CustomObject : ISerializable
{
    public int Value = 42;
    public string Text = "Custom";

    public SerializedProperty Serialize(SerializationContext ctx)
    {
        var compound = SerializedProperty.NewCompound();
        compound.Add("customValue", new SerializedProperty(PropertyType.Int, Value));
        compound.Add("customText", new SerializedProperty(PropertyType.String, Text));
        return compound;
    }

    public void Deserialize(SerializedProperty tag, SerializationContext ctx)
    {
        Value = tag.Get("customValue").IntValue;
        Text = tag.Get("customText").StringValue;
    }
}

Working with Collections

// Lists
var list = new List<string> { "one", "two", "three" };
var serializedList = Serializer.Serialize(list);

// Dictionaries
var dict = new Dictionary<string, int> {
    { "one", 1 },
    { "two", 2 }
};
var serializedDict = Serializer.Serialize(dict);

// Arrays
var array = new int[] { 1, 2, 3, 4, 5 };
var serializedArray = Serializer.Serialize(array);

Handling Circular References

var parent = new CircularObject();
parent.Child = new CircularObject();
parent.Child.Child = parent; // Circular reference
var serialized = Serializer.Serialize(parent);

Using Attributes

public class MyClass
{
    [FormerlySerializedAs("oldName")]
    public string NewName = "Test";

    [IgnoreOnNull]
    public string? OptionalField = null;
}

Limitations

  • Does not serialize Properties
  • No benchmarks exist but performance is expected to be lacking

License

This component is part of the Prowl Game Engine and is licensed under the MIT License. See the LICENSE file in the project root for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Prowl.Echo:

Repository Stars
ProwlEngine/Prowl
An Open Source C# 3D Game Engine under MIT license, inspired by Unity and featuring a complete editor
Version Downloads Last updated
1.0.2 87 11/25/2024
1.0.1 57 11/25/2024