Example #1
0
        //--data--//

        /// <summary>
        /// 读出一个非空数据(完整版)
        /// </summary>
        public BaseData readDataFullNotNull()
        {
            if (isEmpty())
            {
                return(null);
            }

            startReadObj();

            int dataID = this.readShort();

            BaseData data;

            if (dataID <= 0)
            {
                Ctrl.log("不该找不到dataID", dataID);
                data = null;
            }
            else
            {
                data = BytesControl.getDataByID(dataID);

                if (data != null)
                {
                    data.readBytesFullWithoutLen(this);
                }
            }

            endReadObj();

            return(data);
        }
Example #2
0
        /// <summary>
        /// 读出一个非空数据(可继承的)(简版)
        /// </summary>
        public BaseData readDataSimpleNotNull()
        {
            if (isEmpty())
            {
                return(null);
            }

            int dataID = this.readShort();

            BaseData data;

            if (dataID <= 0)
            {
                Ctrl.log("不该找不到dataID", dataID);
                data = null;
            }
            else
            {
                data = BytesControl.getDataByID(dataID);

                if (data != null)
                {
                    data.readBytesSimple(this);
                }
            }

            return(data);
        }
Example #3
0
        /// <summary>
        /// 克隆数据
        /// </summary>
        public BaseData clone()
        {
            BaseData re = BytesControl.getDataByID(_dataID);

            re.copy(this);

            return(re);
        }
Example #4
0
        /** 创建数据 */
        public BaseData createData(int type)
        {
            if (_pool != null)
            {
                return(_pool.createData(type));
            }

            return(BytesControl.getDataByID(type));
        }