Giter Club home page Giter Club logo

zeroformatter's Issues

F# Support Extension

Priority is not high:)

  • Unit
  • Record(use Struct format)
  • Discriminated Union(use Union format)
  • FSharpList
  • FSharpSet
  • FSharpMap
  • FSharpOption

Create Formatters

  • Primitive(bool, byte, sbyte, float, double, short, ushort, int uint, long, ulong) + Nullable
  • char + Nullable
  • decimal + NUllable
  • String
  • Timespan + Nullable
  • DateTime + Nullable
  • DateTimeOffset + Nullable
  • FixedList
  • VariableList
  • ByteArray
  • Dictionary
  • Lookup
  • KeyTuple
  • Enum
  • Object

Project Structures Change

separate common interfaces and KeyTuple for share unity and .Net
-> PCL?, it can import Unity and .NET Core?

Create Segments

Segments is mutable format.

  • Object
  • Support, IZeroFormatterSegment(check with Serialize(Stream)
  • etc...

.Net 2.0 subset

In Unity, Is there any specific feature that should not be used if I build with ".Net 2.0 subset" instead of ".Net 2.0"?

Currently testing with simple Person class, the program built without problem.

Serialization fails with NullReferenceException on Android

https://github.com/akerusoft/UnityTestZeroFormatter2

上記のUnityプロジェクトでUnionのテストをしていたのですが
Windowsのエディタ、iPhoneでは同じコードでも問題がなく実行できるですが
Androidの実機だとNullReferenceExceptionで処理が落ちてしまいます。

ZeroFormatterはv1.4.1のものをNugetで取得して使用。
Unityは5.4.2p4を使用しています。

スタックトレース
? I: Decided to move IRQ215 from CPU7 to CPU4
? I: NullReferenceException: Object reference not set to an instance of an object
at ZeroFormatter.Internal.BinaryUtil.WriteSingle (System.Byte[]& bytes, Int32 offset, Single value) [0x00000] in :0
at ZeroFormatter.Formatters.SingleFormatter.Serialize (System.Byte[]& bytes, Int32 offset, Single value) [0x00000] in :0
at ZeroFormatter.Segments.ObjectSegmentHelper.SerializeFromFormatter[Single] (System.Byte[]& bytes, Int32 startOffset, Int32 offset, Int32 index, Single value) [0x00000] in :0
at ZeroFormatter.DynamicObjectSegments.MonsterDataV1Formatter.Serialize (System.Byte[]& bytes, Int32 offset, .MonsterDataV1 value) [0x00000] in :0
at ZeroFormatter.DynamicObjectSegments.MonsterDataBaseFormatter.Serialize (System.Byte[]& bytes, Int32 offset, .MonsterDataBase value) [0x00000] in :0
at ZeroFormatter.ZeroFormatterSerializer.Serialize[MonsterDataBase] (System.Byte[]& buffer, Int32 offset, .MonsterDataBase obj)

いくつかのAndroid実機で試しました同様にNullReferenceExceptionが出るようです。

確認ですがZeroFormatter.Interfaces.dllは「net35-Unity Full v3.5」フォルダにあるものを使用すれば良いのですよね?

ReadMe and WireFormat

  • Make NuGet Package and Upload
  • ReadMe(for closed release)
  • ReadMe(for open release)

Add NullDirtyTracker

when object deserializing, does not create child if tracker is nulltracker.

    public class DirtyTracker
    {
        internal static readonly DirtyTracker NullTracker = new NullDirtyTracker();

        readonly DirtyTracker parent;

        public virtual bool IsDirty { get; private set; }

        public DirtyTracker()
        {
            this.IsDirty = false;
        }

        DirtyTracker(DirtyTracker parent)
        {
            this.parent = parent;
            IsDirty = parent.IsDirty;
        }

        public virtual void Dirty()
        {
            IsDirty = true;
            if (parent != null)
            {
                parent.Dirty();
            }
        }

        public virtual DirtyTracker CreateChild()
        {
            return new DirtyTracker(this);
        }
    }

    public sealed class NullDirtyTracker : DirtyTracker
    {
        public override bool IsDirty
        {
            get { return false; }
        }

        public override void Dirty()
        {
        }

        public override DirtyTracker CreateChild()
        {
            return DirtyTracker.NullTracker;
        }
    }

Unity Client Generate

  • Generate Enum + Nullable
  • Generate EnumEqualityComparer
  • Generate Formatter + ObjectSegment
  • Collect Types by Roslyn
  • Create Unity Project
  • Import UnitTest for Unity
  • Setup CloudBuild and check on iOS(IL2CPP Safe)
  • Generate Register(for Unity)

Types

  • List
  • Array
  • Dictionary
  • SlimDictionary

Annotationless polymorphic union types

Hi,

I wonder how hard it would be to support something similar to protobuf-net's RuntimeTypeModel.AddSubType() so that one can configure inheritance trees with some dynamic rules instead of static annotation + enum + override?
When modelling protocol with big open inheritance trees like Message or Event it is very convenient if you can use convention based approach (for example using reflection scan + consistent hash of message type name as id in union type, works well even with complicated Unity targets like IL2CPP if you can generate dynamic model in full .net runtime environment and then feed it into static protocol compiler to generate stripped protocol dll like in protobuf-net)

Thank you
Sergii

Support Additional Collections

Priority is low:)

System.Collections.Generic

  • Queue
  • Stack
  • LinkedList
  • SortedList
  • SortedDictionary

System.Collections.ObjectModel

  • KeyedCollection
  • ObservableCollection
  • ReadOnlyObservableCollection
  • ReadOnlyDictionary
  • ReadOnlyCollection

System.Collections.Concurrent

  • ConcurrentBag
  • ConcurrentDictionary
  • ConcurrentQueue
  • ConcurrentStack

System.Collections.Immutable

  • ImmutableArray
  • ImmutableDictionary
  • ImmutableHashSet
  • ImmutableList
  • ImmutableSortedDictionary
  • ImmutableQueue
  • ImmutableStack

zfc.exe -n flag does not add namespace import for ZeroFormatter

If I run:

zfc -i Assembly-CSharp.csproj -o Assets/Scripts/Models/Generated.cs

Everything works fine because the generated files belong to default ZeroFormatter namespace. But if I run zfc with custom namespace:

zfc -i Assembly-CSharp.csproj -o Assets/Scripts/Models/Generated.cs -n Models

Then I would get multiple import errors for ZeroFormatter.DirtyTracker etc, because the generate file under custom namespace Models is missing using ZeroFormatter; at the top.

Of course this can be easily worked around by adding the import statement in. But probably best to fix it in the code generator.

Embedded compression(LZ4)

Compression and serialization are inseparable relationships.
By including LZ4 support in the API, we try more efficient compression.
For that, I need to implement LZ4 myself (lz4.net is not a good choice).

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.