Esempio n. 1
0
        public void Read(TReader reader)
        {
            reader.ReadStructBegin("login_req");
            {
                if (reader.ReadFieldBegin("name"))
                {
                    reader.Read(out this._name);
                }
                reader.ReadFieldEnd("name");
            }

            {
                if (reader.ReadFieldBegin("password"))
                {
                    reader.Read(out this._password);
                }
                reader.ReadFieldEnd("password");
            }

            {
                if (reader.ReadFieldBegin("age"))
                {
                    reader.Read(out this._age);
                }
                reader.ReadFieldEnd("age");
            }


            reader.ReadStructEnd("login_req");
        }
Esempio n. 2
0
        public void Read(TReader reader)
        {
            reader.ReadStructBegin("message");
            {
                if (reader.ReadFieldBegin("mid"))
                {
                    int e;
                    reader.Read(out e);
                    this._mid = (message_id)e;
                }
                else
                {
                    string es;
                    reader.Read(out es);
                    this._mid = (message_id)Enum.Parse(typeof(message_id), es);
                }
                reader.ReadFieldEnd("mid");
            }

            {
                if (reader.ReadFieldBegin("body"))
                {
                    this._body.Read(reader, this.mid);
                }
                reader.ReadFieldEnd("body");
            }


            reader.ReadStructEnd("message");
        }
Esempio n. 3
0
        public void Read(TReader reader, message_id selector)
        {
            reader.ReadUnionBegin("message_body");
            switch (selector)
            {
            case message_id.E_MID_LOGIN_REQ:
                if (reader.ReadFieldBegin("login_req"))
                {
                    this._login_req = new login_req();
                    this._login_req.Read(reader);
                }
                reader.ReadFieldEnd("login_req");
                break;

            case message_id.E_MID_LOGIN_RSP:
                if (reader.ReadFieldBegin("login_rsp"))
                {
                    this._login_rsp = new login_rsp();
                    this._login_rsp.Read(reader);
                }
                reader.ReadFieldEnd("login_rsp");
                break;

            default:
                break;
            }
            reader.ReadUnionEnd("message_body");
        }
Esempio n. 4
0
        public void Read(TReader reader)
        {
            reader.ReadStructBegin("tconnd_instance_config");
            {
                if (reader.ReadFieldBegin("level"))
                {
                    int e;
                    reader.Read(out e);
                    this._level = (tconnd_instance_level)e;
                }
                else
                {
                    string es;
                    reader.Read(out es);
                    this._level = (tconnd_instance_level)Enum.Parse(typeof(tconnd_instance_level), es);
                }
                reader.ReadFieldEnd("level");
            }

            {
                if (reader.ReadFieldBegin("ip"))
                {
                    reader.Read(out this._ip);
                }
                reader.ReadFieldEnd("ip");
            }

            {
                if (reader.ReadFieldBegin("port"))
                {
                    reader.Read(out this._port);
                }
                reader.ReadFieldEnd("port");
            }

            {
                if (reader.ReadFieldBegin("backlog"))
                {
                    reader.Read(out this._backlog);
                }
                reader.ReadFieldEnd("backlog");
            }

            {
                if (reader.ReadFieldBegin("epoll_size"))
                {
                    reader.Read(out this._epoll_size);
                }
                reader.ReadFieldEnd("epoll_size");
            }


            reader.ReadStructEnd("tconnd_instance_config");
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the current buffer reader from the thread context
        /// </summary>
        /// <typeparam name="TReader">The type of the reader.</typeparam>
        /// <returns></returns>
        public static IBufferReader GetCurrent <TReader>()
            where TReader : IBufferReader, new()
        {
            var slot   = Thread.GetNamedDataSlot(c_ThreadBufferSegmentReader);
            var reader = Thread.GetData(slot) as IBufferReader;

            if (reader == null)
            {
                reader = new TReader();
                Thread.SetData(slot, reader);
            }

            return(reader);
        }
Esempio n. 6
0
        public void Read(TReader reader)
        {
            reader.ReadStructBegin("tconnd_config");
            {
                if (reader.ReadFieldBegin("log_config"))
                {
                    reader.Read(out this._log_config);
                }
                reader.ReadFieldEnd("log_config");
            }

            {
                reader.ReadVectorBegin();

                if (reader.ReadFieldBegin("instance_config_num"))
                {
                    reader.Read(out this._instance_config_num);
                    this._instance_config = new tconnd_instance_config[this._instance_config_num];
                }
                reader.ReadFieldEnd("instance_config_num");

                for (uint i = 0; i < Constants.TONND_CONFIG_NUM; ++i)
                {
                    if (i == this._instance_config_num)
                    {
                        break;
                    }

                    if (reader.ReadVectorElementBegin("instance_config", i))
                    {
                        this._instance_config[i] = new tconnd_instance_config();
                        this._instance_config[i].Read(reader);
                    }
                    reader.ReadVectorElementEnd("instance_config", i);
                }
                reader.ReadVectorEnd();
            }


            reader.ReadStructEnd("tconnd_config");
        }
Esempio n. 7
0
        public void Read(TReader reader)
        {
            reader.ReadStructBegin("login_rsp");
            {
                if (reader.ReadFieldBegin("result"))
                {
                    reader.Read(out this._result);
                }
                reader.ReadFieldEnd("result");
            }

            if (this.result == 0)
            {
                if (reader.ReadFieldBegin("session_id"))
                {
                    reader.Read(out this._session_id);
                }
                reader.ReadFieldEnd("session_id");
            }


            reader.ReadStructEnd("login_rsp");
        }
Esempio n. 8
0
        public void Read(TReader reader)
        {
            reader.ReadStructBegin("item_table");
            {
                if (reader.ReadFieldBegin("ID"))
                {
                    reader.Read(out this._ID);
                }
                reader.ReadFieldEnd("ID");
            }

            {
                if (reader.ReadFieldBegin("ItemName"))
                {
                    reader.Read(out this._ItemName);
                }
                reader.ReadFieldEnd("ItemName");
            }

            {
                if (reader.ReadFieldBegin("Metempsychosis"))
                {
                    reader.Read(out this._Metempsychosis);
                }
                reader.ReadFieldEnd("Metempsychosis");
            }

            {
                if (reader.ReadFieldBegin("UseTime"))
                {
                    reader.Read(out this._UseTime);
                }
                reader.ReadFieldEnd("UseTime");
            }

            {
                if (reader.ReadFieldBegin("Bill"))
                {
                    reader.Read(out this._Bill);
                }
                reader.ReadFieldEnd("Bill");
            }

            {
                if (reader.ReadFieldBegin("ReplaceItem"))
                {
                    reader.Read(out this._ReplaceItem);
                }
                reader.ReadFieldEnd("ReplaceItem");
            }

            {
                if (reader.ReadFieldBegin("Medals"))
                {
                    reader.Read(out this._Medals);
                }
                reader.ReadFieldEnd("Medals");
            }

            {
                if (reader.ReadFieldBegin("Value"))
                {
                    reader.Read(out this._Value);
                }
                reader.ReadFieldEnd("Value");
            }

            {
                if (reader.ReadFieldBegin("ReserveMoneyFlag"))
                {
                    reader.Read(out this._ReserveMoneyFlag);
                }
                reader.ReadFieldEnd("ReserveMoneyFlag");
            }

            {
                if (reader.ReadFieldBegin("Quality"))
                {
                    reader.Read(out this._Quality);
                }
                reader.ReadFieldEnd("Quality");
            }

            {
                if (reader.ReadFieldBegin("ItemType"))
                {
                    int e;
                    reader.Read(out e);
                    this._ItemType = (item_type)e;
                }
                else
                {
                    string es;
                    reader.Read(out es);
                    this._ItemType = (item_type)Enum.Parse(typeof(item_type), es);
                }
                reader.ReadFieldEnd("ItemType");
            }

            {
                if (reader.ReadFieldBegin("UseSingTime"))
                {
                    reader.Read(out this._UseSingTime);
                }
                reader.ReadFieldEnd("UseSingTime");
            }

            {
                if (reader.ReadFieldBegin("UserTarget"))
                {
                    reader.Read(out this._UserTarget);
                }
                reader.ReadFieldEnd("UserTarget");
            }

            {
                if (reader.ReadFieldBegin("CanMoved"))
                {
                    reader.Read(out this._CanMoved);
                }
                reader.ReadFieldEnd("CanMoved");
            }

            {
                if (reader.ReadFieldBegin("CanDeleted"))
                {
                    reader.Read(out this._CanDeleted);
                }
                reader.ReadFieldEnd("CanDeleted");
            }

            {
                if (reader.ReadFieldBegin("CanTrade"))
                {
                    reader.Read(out this._CanTrade);
                }
                reader.ReadFieldEnd("CanTrade");
            }

            {
                if (reader.ReadFieldBegin("CanSold"))
                {
                    reader.Read(out this._CanSold);
                }
                reader.ReadFieldEnd("CanSold");
            }

            {
                if (reader.ReadFieldBegin("CanStored"))
                {
                    reader.Read(out this._CanStored);
                }
                reader.ReadFieldEnd("CanStored");
            }

            {
                if (reader.ReadFieldBegin("CanLocked"))
                {
                    reader.Read(out this._CanLocked);
                }
                reader.ReadFieldEnd("CanLocked");
            }

            {
                if (reader.ReadFieldBegin("CanBound"))
                {
                    reader.Read(out this._CanBound);
                }
                reader.ReadFieldEnd("CanBound");
            }

            {
                if (reader.ReadFieldBegin("IsExclusive"))
                {
                    reader.Read(out this._IsExclusive);
                }
                reader.ReadFieldEnd("IsExclusive");
            }

            {
                if (reader.ReadFieldBegin("IsExpendable"))
                {
                    reader.Read(out this._IsExpendable);
                }
                reader.ReadFieldEnd("IsExpendable");
            }

            {
                if (reader.ReadFieldBegin("ColdDownType"))
                {
                    reader.Read(out this._ColdDownType);
                }
                reader.ReadFieldEnd("ColdDownType");
            }

            {
                if (reader.ReadFieldBegin("ColdDownTime"))
                {
                    reader.Read(out this._ColdDownTime);
                }
                reader.ReadFieldEnd("ColdDownTime");
            }

            {
                if (reader.ReadFieldBegin("CanDrop"))
                {
                    reader.Read(out this._CanDrop);
                }
                reader.ReadFieldEnd("CanDrop");
            }

            {
                if (reader.ReadFieldBegin("DecomposePackID"))
                {
                    reader.Read(out this._DecomposePackID);
                }
                reader.ReadFieldEnd("DecomposePackID");
            }

            {
                if (reader.ReadFieldBegin("IsMerge"))
                {
                    reader.Read(out this._IsMerge);
                }
                reader.ReadFieldEnd("IsMerge");
            }

            {
                reader.ReadVectorBegin();

                if (reader.ReadFieldBegin("vec_num"))
                {
                    reader.Read(out this._vec_num);
                    this._vec = new string[this._vec_num];
                }
                reader.ReadFieldEnd("vec_num");

                for (uint i = 0; i < Constants.ITEM_VEC_NUM; ++i)
                {
                    if (i == this._vec_num)
                    {
                        break;
                    }

                    if (reader.ReadVectorElementBegin("vec", i))
                    {
                        reader.Read(out this._vec[i]);
                    }
                    reader.ReadVectorElementEnd("vec", i);
                }
                reader.ReadVectorEnd();
            }


            reader.ReadStructEnd("item_table");
        }
Esempio n. 9
0
 void IDbReaderInterceptor <TCommand, TReader> .OnExecuted(Model model, TCommand command, TReader result, AddonInvoker invoker)
 {
     OnExecuted(command, result, invoker);
 }