Пример #1
0
        /*
         * 0xcc   int8
         * length int32
         * flowId int32
         * moduleId int8
         * messageId int16
         * protobuffer
         */
        public uint writePB(byte[] v)
        {
            byte fid = flowId++;

            if (fid == 0)
            {
                fid++;
                flowId++;
            }

            int bodyLength  = 1 + 1 + 1 + v.Length;
            int totalLength = 2 + bodyLength;

            //checkStream (totalLength);
            //Debug.Log ("Bundle::writePB pack data is "+bodyLength+" pb length "+v.Length+" totalLength "+totalLength);
            //Debug.Log ("Bundle::writePB module Id msgId " + moduleId+" "+msgId);
            //stream.writeUint8 (Convert.ToByte(0xcc));
            stream.writeUint16(Convert.ToUInt16(bodyLength));
            stream.writeUint8(Convert.ToByte(fid));
            stream.writeUint8(Convert.ToByte(moduleId));
            stream.writeUint8(Convert.ToByte(msgId));
            stream.writePB(v);

            return(fid);
        }
Пример #2
0
        /*
         * 0xcc   int8
         * length int32
         * flowId int32
         * moduleId int8
         * messageId int16
         * protobuffer
         */
        public uint writePB(byte[] v)
        {
            byte fid = flowId++;

            if (fid == 0)
            {
                fid++;
                flowId++;
            }

            int bodyLength  = 1 + 1 + 1 + v.Length;
            int totalLength = 2 + bodyLength;

            stream.writeUint16(Convert.ToUInt16(bodyLength));
            stream.writeUint8(Convert.ToByte(fid));
            stream.writeUint8(Convert.ToByte(moduleId));
            stream.writeUint8(Convert.ToByte(msgId));
            stream.writePB(v);
            return(fid);
        }