Ejemplo n.º 1
0
        private Object decodeData(byte[] data, Object proxy)
        {
            _is.wrap(data);
            _is.setServerEncoding(_encodeName);
            Object o = _is.read(proxy, 0, true);

            return(o);
        }
Ejemplo n.º 2
0
        /**
         * 对传入的数据进行解码 填充可get的对象
         */

        public new void Decode(byte[] buffer, int Index = 0)
        {
            if (buffer.Length < UniPacketHeadSize)
            {
                throw new ArgumentException("Decode namespace must include size head");
            }

            try
            {
                TarsInputStream _is = new TarsInputStream(buffer, UniPacketHeadSize + Index);
                _is.setServerEncoding(EncodeName);
                //解码出RequestPacket包
                this.ReadFrom(_is);

                //设置tup版本
                _iVer = _package.iVersion;

                _is = new TarsInputStream(_package.sBuffer);
                _is.setServerEncoding(EncodeName);

                if (_package.iVersion == Const.PACKET_TYPE_TUP)
                {
                    _data = (Dictionary <string, Dictionary <string, byte[]> >)_is.readMap <Dictionary <string, Dictionary <string, byte[]> > >(0, false);
                }
                else
                {
                    _new_data = (Dictionary <string, byte[]>)_is.readMap <Dictionary <string, byte[]> >(0, false);
                }
            }
            catch (Exception e)
            {
                QTrace.Trace(this + " Decode Exception: " + e.Message);
                throw (e);
            }
        }