Giter VIP home page Giter VIP logo

tagsrocks / freecraftcore.serializer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freecraftcore/freecraftcore.serializer

0.0 1.0 0.0 42.18 MB

.NET Serializer library inspired by Blizzard's JAM for the FreecraftCore project. Supports a super-set of the WoW Protocol for versions 1.1.12-3.3.5.

License: GNU Affero General Public License v3.0

C# 99.75% Shell 0.11% Batchfile 0.02% PowerShell 0.12%

freecraftcore.serializer's Introduction

FreecraftCore.Serializer

Now with Netstandard1.5 and Async/Await support!

FreecraftCore is an open-source C#/.NET World of Warcraft emulation project. It is derived from the reverse engineering work done by Mangos and Trinitycore.

The FreecraftCore.Payload.Serializer is a metadata based serializer for WoW packets based on JAM and inspired by the design of Protobuf-net by Marc.

Implementation

The Serializer reflects on Types for attributes (looks at metadata) marked on wire message types to build a simple serializer that reads and writes from a stream. The primitive datatype reading and writing is based on Trinitycore's ByteBuffer. All serialization is just a decoration of the primitive datatype serialization strategies.

In short, FreecraftCore.Serializer knows how to serialize primitives in the fashion that the WoW protocol excepts and all serialization functionality is an extension of this via decoration.

To understand how this serializer works read documentation related to Protobuf-Net here. The design is similar.

Creating a Payload/WireMessage/Packet

[WireDataContract] //mark wire messages with this attribute
public class MyMessagePayload
{
  [WireMember(1)] //Mark members you want sent over the network with [WireMember] attributes. A unique per class int key is required.
  public int Damage;
 
  [WireMember(5)] //the keys don't need to go in sequence. No benefit really.
  public string TargetName;
  
  [WireMember(7)]
  public MyCustomType Instance; //you can send custom types over the network too.
  
  //Arrays, Enums and even some basic Polymorphism works!
  
  public MyMessagePayload() //as of right now the serializer requires a parameterless ctor. This will be changed in the future
  {
  
  }
}

public class MyCustomType //non wiremessages don't need to be marked but if you want to use polymorphic serialization you should mark
{
  [WireMember(1)]
  public int data;
  
  public MyMessagePayload() //non wire messages still require a parameterless ctor (for now)
  {
  
  }
}

Unsupported Serialization Scenarios

[KnownSize(5)]
[WireMember(1)]
SomeType[][] //Multidimensional arrays are partially supported but not fixed sized ones.
[WireMember(1)]
IEnumerable<SomeType> //Any collection except arrays are currently unsupported but planned for future support

Polymorphic Serialization is now supported for classes! Interfaces in the future.

Builds

Available on a Nuget Feed: https://www.myget.org/F/freecraftcore/api/v2 freecraftcore MyGet Build Status

Tests

Linux Debug Windows .NET Debug
master Build Status TODO
dev Build Status TODO

Windows - Unit Tests

(Done locally)

Licensing

This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE so follow it or I will report you to the software gods.

freecraftcore.serializer's People

Contributors

hellokitty avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.