예제 #1
0
        private Object DecodeData(byte[] data, Object proxy)
        {
            _is.Wrap(data);
            _is.SetServerEncoding(_encodeName);
            Object obj = _is._Read(proxy, 0, true);

            return(obj);
        }
예제 #2
0
파일: UniAttribute.cs 프로젝트: fs7744/Tars
 public void DecodeTup3(TarsInputStream inputStream, int Index = 0)
 {
     Version = Const.PacketTypeTup3;
     inputStream.SetServerEncoding(EncodeName);
     newData = new Dictionary <string, byte[]>();
     inputStream.ReadMap <string, byte[]>(newData, 0, false);
 }
예제 #3
0
        private object DecodeBuffer(byte[] buffer, Type type)
        {
            TarsInputStream tis = new TarsInputStream(buffer);

            tis.SetServerEncoding(EncodeName);
            var result = tis.Read(type, 0, true);

            return(result);
        }
예제 #4
0
        internal void Decode(byte[] buffer)
        {
            TarsInputStream tis = new TarsInputStream(buffer);

            tis.SetServerEncoding(EncodeName);
            if (IsVersionTup3)
            {
                tis.ReadMap(newData, 0, false);
            }
            else
            {
                tis.ReadMap(data, 0, false);
            }
        }
예제 #5
0
        /**
         * Decode incoming data, fill in getable objects.
         */
        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);

                // Decode the RequestPacket package.
                this.ReadFrom(_is);

                // Set the tup version.
                _iVer = _package.iVersion;

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

                if (_package.iVersion == Const.TUP_VERSION_2)
                {
                    _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 ex)
            {
                QTrace.Trace(this + " Decode Exception: " + ex.Message);
                throw (ex);
            }
        }