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));
            }
        }
Exemple #2
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));
            }
        }
Exemple #3
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::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 int Serialize(ref byte[] targetBytes, int offset)
        {
            if (__extraFixedBytes != null || __tracker.IsDirty)
            {
                var startOffset = offset;
                offset += (8 + 4 * (0 + 1));

                offset += ObjectSegmentHelper.SerializeFixedLength <global::Test3.LanguageType>(ref targetBytes, startOffset, offset, 0, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);

                return(ObjectSegmentHelper.WriteSize(ref targetBytes, startOffset, offset, 0));
            }
            else
            {
                return(ObjectSegmentHelper.DirectCopyAll(__originalBytes, ref targetBytes, offset));
            }
        }
Exemple #7
0
        public int Serialize(ref byte[] targetBytes, int offset)
        {
            if (__extraFixedBytes != null || __tracker.IsDirty)
            {
                var startOffset = offset;
                offset += (8 + 4 * (1 + 1));

                offset += ObjectSegmentHelper.SerializeFixedLength <TTypeResolver, int>(ref targetBytes, startOffset, offset, 0, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeCacheSegment <TTypeResolver, string>(ref targetBytes, startOffset, offset, 1, _Data);

                return(ObjectSegmentHelper.WriteSize(ref targetBytes, startOffset, offset, 1));
            }
            else
            {
                return(ObjectSegmentHelper.DirectCopyAll(__originalBytes, ref targetBytes, offset));
            }
        }
Exemple #8
0
        public int Serialize(ref byte[] targetBytes, int offset)
        {
            if (__extraFixedBytes != null || __tracker.IsDirty)
            {
                var startOffset = offset;
                offset += (8 + 4 * (1 + 1));

                offset += ObjectSegmentHelper.SerializeCacheSegment <TTypeResolver, global::Sandbox.RoomMember>(ref targetBytes, startOffset, offset, 0, _Sender);
                offset += ObjectSegmentHelper.SerializeCacheSegment <TTypeResolver, string>(ref targetBytes, startOffset, offset, 1, _Message);

                return(ObjectSegmentHelper.WriteSize(ref targetBytes, startOffset, offset, 1));
            }
            else
            {
                return(ObjectSegmentHelper.DirectCopyAll(__originalBytes, ref targetBytes, offset));
            }
        }
        public int Serialize(ref byte[] targetBytes, int offset)
        {
            if (__extraFixedBytes != null || __tracker.IsDirty)
            {
                var startOffset = offset;
                offset += (8 + 4 * (3 + 1));

                offset += ObjectSegmentHelper.SerializeSegment <TTypeResolver, global::System.Collections.Generic.IList <float[]> >(ref targetBytes, startOffset, offset, 0, _vertices);
                offset += ObjectSegmentHelper.SerializeSegment <TTypeResolver, global::System.Collections.Generic.IList <float[]> >(ref targetBytes, startOffset, offset, 1, _uvs);
                offset += ObjectSegmentHelper.SerializeSegment <TTypeResolver, global::System.Collections.Generic.IList <float[]> >(ref targetBytes, startOffset, offset, 2, _normals);
                offset += ObjectSegmentHelper.SerializeSegment <TTypeResolver, global::System.Collections.Generic.IList <int[]> >(ref targetBytes, startOffset, offset, 3, _faces);

                return(ObjectSegmentHelper.WriteSize(ref targetBytes, startOffset, offset, 3));
            }
            else
            {
                return(ObjectSegmentHelper.DirectCopyAll(__originalBytes, ref targetBytes, offset));
            }
        }
Exemple #10
0
        public int Serialize(ref byte[] targetBytes, int offset)
        {
            if (__extraFixedBytes != null || __tracker.IsDirty)
            {
                var startOffset = offset;
                offset += (8 + 4 * (6 + 1));

                offset += ObjectSegmentHelper.SerializeFixedLength <TTypeResolver, int>(ref targetBytes, startOffset, offset, 0, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeFixedLength <TTypeResolver, int>(ref targetBytes, startOffset, offset, 1, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeCacheSegment <TTypeResolver, string>(ref targetBytes, startOffset, offset, 2, _z);
                offset += ObjectSegmentHelper.SerializeFixedLength <TTypeResolver, global::SharedLibrary.MyEnum>(ref targetBytes, startOffset, offset, 3, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeCacheSegment <TTypeResolver, global::SharedLibrary.MyStructResponse>(ref targetBytes, startOffset, offset, 4, _soho);
                offset += ObjectSegmentHelper.SerializeFixedLength <TTypeResolver, ulong>(ref targetBytes, startOffset, offset, 5, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeSegment <TTypeResolver, global::SharedLibrary.MyRequest>(ref targetBytes, startOffset, offset, 6, _req);

                return(ObjectSegmentHelper.WriteSize(ref targetBytes, startOffset, offset, 6));
            }
            else
            {
                return(ObjectSegmentHelper.DirectCopyAll(__originalBytes, ref targetBytes, offset));
            }
        }
Exemple #11
0
        public int Serialize(ref byte[] targetBytes, int offset)
        {
            if (__tracker.IsDirty)
            {
                var lastIndex   = 4; // schemaLastIndex
                var startOffset = offset;
                offset += (8 + 4 * (lastIndex + 1));

                // Auto Generate Area(incr index...)
                offset += ObjectSegmentHelper.SerializeFixedLength <int>(ref targetBytes, startOffset, offset, 0, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeCacheSegment <string>(ref targetBytes, startOffset, offset, 1, _firstName);
                offset += ObjectSegmentHelper.SerializeCacheSegment <string>(ref targetBytes, startOffset, offset, 2, _lastName);
                offset += ObjectSegmentHelper.SerializeFixedLength <int>(ref targetBytes, startOffset, offset, 3, __binaryLastIndex, __originalBytes, __extraFixedBytes, __tracker);
                offset += ObjectSegmentHelper.SerializeSegment <IList <int> >(ref targetBytes, startOffset, offset, 4, _myList);

                return(ObjectSegmentHelper.WriteSize(ref targetBytes, startOffset, offset, lastIndex));
            }
            else
            {
                return(ObjectSegmentHelper.DirectCopyAll(__originalBytes, ref targetBytes, offset));
            }
        }
        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));
            }
        }
Exemple #13
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));
            }
        }
Exemple #14
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));
            }
        }