Пример #1
0
        // ownerContext should be match the context to be registered.
        public MsgPackMessageSerializer(SerializationContext ownerContext) : base(ownerContext)
        {
            var subtypes = new Type[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(UInt16), typeof(UInt32), typeof(Int64), typeof(UInt64) };

            AsInt = new HashSet <Type>(subtypes);

            OwnerContext.ExtTypeCodeMapping.Add("Time", 0x10);
            OwnerContext.ExtTypeCodeMapping.Add("Raw", 0x11);

            TimeSerializer   = new MsgPackTimeSerializer(OwnerContext);
            StreamSerializer = new MsgPackStreamSerializer(OwnerContext);

            OwnerContext.ExtTypeCodeMapping.Add("Vector2d", 0x12);
            OwnerContext.ExtTypeCodeMapping.Add("Vector3d", 0x13);
            OwnerContext.ExtTypeCodeMapping.Add("Vector4d", 0x14);
            OwnerContext.ExtTypeCodeMapping.Add("Transform", 0x15);
            OwnerContext.ExtTypeCodeMapping.Add("Color", 0x16);

            Vector2dSerializer = new MsgPackVector2dSerializer(OwnerContext);
            Vector3dSerializer = new MsgPackVector3dSerializer(OwnerContext);
            Vector4dSerializer = new MsgPackVector4dSerializer(OwnerContext);
            MatrixSerializer   = new MsgPackMatrixSerializer(OwnerContext);
            ColorSerializer    = new MsgPackColorSerializer(OwnerContext);
        }