Ejemplo n.º 1
0
        public override int Serialize(ref byte[] bytes, int offset, global::SharedLibrary.MyHugeResponse value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (6 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, int>(ref bytes, startOffset, offset, 0, value.x);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, int>(ref bytes, startOffset, offset, 1, value.y);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, string>(ref bytes, startOffset, offset, 2, value.z);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::SharedLibrary.MyEnum>(ref bytes, startOffset, offset, 3, value.e);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::SharedLibrary.MyStructResponse>(ref bytes, startOffset, offset, 4, value.soho);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, ulong>(ref bytes, startOffset, offset, 5, value.zzz);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::SharedLibrary.MyRequest>(ref bytes, startOffset, offset, 6, value.req);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 6));
            }
        }
Ejemplo n.º 2
0
        public override int Serialize(ref byte[] bytes, int offset, MyClass value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var lastIndex   = 4;
                var startOffset = offset;

                offset += (8 + 4 * (lastIndex + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <int>(ref bytes, startOffset, offset, 0, value.Age);
                offset += ObjectSegmentHelper.SerializeFromFormatter <string>(ref bytes, startOffset, offset, 1, value.FirstName);
                offset += ObjectSegmentHelper.SerializeFromFormatter <string>(ref bytes, startOffset, offset, 2, value.LastName);
                offset += ObjectSegmentHelper.SerializeFromFormatter <int>(ref bytes, startOffset, offset, 3, value.HogeMoge);
                offset += ObjectSegmentHelper.SerializeFromFormatter <IList <int> >(ref bytes, startOffset, offset, 4, value.MyList);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, lastIndex));
            }
        }
        public override int Serialize(ref byte[] bytes, int offset, global::MonsterDataV1 value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (4 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <string>(ref bytes, startOffset, offset, 0, value.Name);
                offset += ObjectSegmentHelper.SerializeFromFormatter <uint>(ref bytes, startOffset, offset, 1, value.HitPoint);
                offset += ObjectSegmentHelper.SerializeFromFormatter <float>(ref bytes, startOffset, offset, 2, value.HitRate);
                offset += ObjectSegmentHelper.SerializeFromFormatter <uint>(ref bytes, startOffset, offset, 3, value.Speed);
                offset += ObjectSegmentHelper.SerializeFromFormatter <uint>(ref bytes, startOffset, offset, 4, value.Luck);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 4));
            }
        }
        public override int Serialize(ref byte[] bytes, int offset, global::MeshStreaming.CustomMesh value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (3 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::System.Collections.Generic.IList <float[]> >(ref bytes, startOffset, offset, 0, value.vertices);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::System.Collections.Generic.IList <float[]> >(ref bytes, startOffset, offset, 1, value.uvs);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::System.Collections.Generic.IList <float[]> >(ref bytes, startOffset, offset, 2, value.normals);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::System.Collections.Generic.IList <int[]> >(ref bytes, startOffset, offset, 3, value.faces);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 3));
            }
        }
        public override int Serialize(ref byte[] bytes, int offset, global::MasterMemory.Tests.Sample value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (3 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, int>(ref bytes, startOffset, offset, 0, value.Id);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, int>(ref bytes, startOffset, offset, 1, value.Age);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, string>(ref bytes, startOffset, offset, 2, value.FirstName);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, string>(ref bytes, startOffset, offset, 3, value.LastName);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 3));
            }
        }
        public override int Serialize(ref byte[] bytes, int offset, global::Test3.SettingDataVer2 value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (0 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <global::Test3.LanguageType>(ref bytes, startOffset, offset, 0, value.Language);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 0));
            }
        }
Ejemplo n.º 7
0
        public override int Serialize(ref byte[] bytes, int offset, global::Sandbox.ChatMessage value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (1 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, global::Sandbox.RoomMember>(ref bytes, startOffset, offset, 0, value.Sender);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, string>(ref bytes, startOffset, offset, 1, value.Message);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 1));
            }
        }
Ejemplo n.º 8
0
        public override int Serialize(ref byte[] bytes, int offset, global::SharedLibrary.MyResponse value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (1 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, int>(ref bytes, startOffset, offset, 0, value.Id);
                offset += ObjectSegmentHelper.SerializeFromFormatter <TTypeResolver, string>(ref bytes, startOffset, offset, 1, value.Data);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 1));
            }
        }
        public override int Serialize(ref byte[] bytes, int offset, global::Test3.SettingDataVer1 value)
        {
            var segment = value as IZeroFormatterSegment;

            if (segment != null)
            {
                return(segment.Serialize(ref bytes, offset));
            }
            else if (value == null)
            {
                BinaryUtil.WriteInt32(ref bytes, offset, -1);
                return(4);
            }
            else
            {
                var startOffset = offset;

                offset += (8 + 4 * (1 + 1));
                offset += ObjectSegmentHelper.SerializeFromFormatter <float>(ref bytes, startOffset, offset, 0, value.MusicVolume);
                offset += ObjectSegmentHelper.SerializeFromFormatter <float>(ref bytes, startOffset, offset, 1, value.EffectsVolume);

                return(ObjectSegmentHelper.WriteSize(ref bytes, startOffset, offset, 1));
            }
        }