public IByteBuffer TryEncodePackage(ResponsePackage package, byte[] data = null)
        {
            MessageHead      head = new MessageHead(package.MsgId, package.ActionId, package.St, package.ErrorCode, package.ErrorInfo);
            MessageStructure sb   = new MessageStructure();

            sb.WriteBuffer(head);
            if (data != null && data.Length != 0)
            {
                sb.WriteByte(data);
            }
            return(Unpooled.WrappedBuffer(sb.PopBuffer()));
        }
Exemple #2
0
        private MessageStructure verifyDeliver(Dictionary <string, string> parms)
        {
            MessageStructure ms = new MessageStructure();

            try
            {
                while (true)
                {
                    parms.TryGetValue("ID", out _OperateName);

                    if (_OperateName == "LevelRankingData")
                    {
                        int pagecout;
                        var ranking = RankingFactory.Get <UserRank>(LevelRanking.RankingKey);
                        var list    = ranking.GetRange(0, 50, out pagecout);

                        ms.WriteByte(list.Count);
                        foreach (var data in list)
                        {
                            ms.WriteByte(data.UserID);
                            ms.WriteByte(data.NickName);
                            ms.WriteByte(data.Profession);
                            ms.WriteByte(data.RankId);
                            ms.WriteByte(data.UserLv);
                            ms.WriteByte(data.FightValue);
                            ms.WriteByte(data.VipLv);
                        }
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                TraceLog.WriteError(string.Format("{0} {1}", "Url参数格式错误", e));
            }
            return(ms);
        }
Exemple #3
0
 private void DoWrite(byte[] buffer)
 {
     _buffers.WriteByte(buffer);
 }