Skip to content

Binary serializer to adapt to legacy data storage and data transfer protocols in C#

License

Notifications You must be signed in to change notification settings

hoshinokanade/AncientArk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AncientArk

Build Status

AncientArk is a binary serializer to adapt to legacy data storage and data transfer protocols. It allows expression mappings of custom types.

Supported platforms: .NET Standard 2.0

AncientArk is suitable for emulating any sequenced data transfer protocols (which does not require jumping when reading/writing).

Legacy data transfer problem

When newly developed applications must to be compatible with a legacy data protocol, where the sequences and types of read/write are magically known in advance. Most of these data protocols are not json, msgpack, not even xml, but some dirty hardcodes. They could be file and packet protocols, as long as they end up in binary format.

AncientArk is then used to bridge the data transfer objects to fit into the protocol. This keeps the compatibility while decouples the nice modern code from the dirty legacy data protocol.

Legacy data protocol are sometimes transferred in TCP/IP instead of mainstream higher-level protocols like HTTPS. Try also Ether.Network to tackle this scenario.

Usage

// Must have a public parameterless constructor
public class Ping
{
    // Now only for properties with public getter & setter
    public int AckNumber {get; set;}
    
    // Custom types could be used with prior registration
    // Custom types must have public parameterless constructor
    public OtherObj ClientInfo {get; set;}
    
    public sealed class PingMap: ProfileMap<Ping>
    {
        public PingMap()
        {
            Map(x => x.AckNumber);
            // ClientInfo is not mapped in, thereby ignored
        }
    }
}

ProfileSerializer.Default.RegisterProfile<Ping>();
Ping ping = new Ping();
ping.AckNumber = 2018;

Memorystream ms = new Memorystream();
ProfileSerializer.Serialize<Ping>(ms, ping);
// Output: E2 07 00 00

Documentation

Our Wiki

License

GNU General Public License v3

http://www.gnu.org/licenses

About

Binary serializer to adapt to legacy data storage and data transfer protocols in C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages