Example #1
0
        public override object Deserialize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(null);
            }
            else
            {
                Color32 color = new Color32();

                color.r = packer.ReadByte();
                color.g = packer.ReadByte();
                color.b = packer.ReadByte();
                color.a = packer.ReadByte();

                return(color);
            }
        }
        public override int GetDataSize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(sizeof(byte));
            }

            packer.Position += sizeof(float) * 2;
            return(sizeof(byte) + sizeof(float) * 2);
        }
Example #3
0
        public override object Deserialize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(null);
            }
            else
            {
                return(TimeSpan.FromTicks(packer.ReadLong()));
            }
        }
Example #4
0
        public override object Deserialize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(null);
            }
            else
            {
                return(DateTime.FromBinary(packer.ReadLong()));
            }
        }
        public override object Deserialize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(null);
            }
            else
            {
                Vector2 vector = new Vector2();

                vector.x = packer.ReadFloat();
                vector.y = packer.ReadFloat();

                return(vector);
            }
        }
Example #6
0
        public override int GetDataSize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(sizeof(byte));
            }

            int size = sizeof(byte);

            for (int i = 0; i < parameters.Count; i++)
            {
                size += converters[i].GetDataSize(packer);
            }

            return(size);
        }
        public override object Deserialize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(null);
            }
            else
            {
                Quaternion quaternion = new Quaternion();

                quaternion.x = packer.ReadFloat();
                quaternion.y = packer.ReadFloat();
                quaternion.z = packer.ReadFloat();
                quaternion.w = packer.ReadFloat();

                return(quaternion);
            }
        }
Example #8
0
        public override object Deserialize(BytePacker packer)
        {
            byte isNull = packer.ReadByte();

            if (isNull == 0)
            {
                return(null);
            }
            else
            {
                object data = Activator.CreateInstance(type);

                for (int i = 0; i < parameters.Count; i++)
                {
                    parameters[i].SetValue(data, converters[i].Deserialize(packer));
                }

                return(data);
            }
        }
Example #9
0
 public override object Deserialize(BytePacker packer)
 {
     return(packer.ReadByte());
 }