예제 #1
0
파일: Serializer.cs 프로젝트: mmvlad/ecs
        public static T Unpack <T>(Serializers allSerializers, byte[] bytes)
        {
            var packer = Serializer.SetupDefaultPacker(allSerializers, bytes);

            var serializer = new GenericSerializer();
            var instance   = (T)serializer.Unpack(packer, typeof(T));

            return(instance);
        }
예제 #2
0
        public static T UnpackStatic <T>(byte[] bytes, Serializers staticSerializers)
        {
            var packer = Serializer.SetupDefaultPacker(staticSerializers, bytes);

            var serializer = new GenericSerializer();
            var result     = (T)serializer.Unpack(packer, typeof(T));

            packer.Dispose();
            return(result);
        }
예제 #3
0
        public static T Unpack <T>(byte[] bytes, Serializers customSerializers)
        {
            var packer = Serializer.SetupDefaultPacker(bytes, customSerializers);

            var serializer = new GenericSerializer();
            var instance   = (T)serializer.Unpack(packer, typeof(T));

            customSerializers.Dispose();
            packer.serializers.Dispose();
            return(instance);
        }