Exemple #1
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int datasLen = stream.readLen();

        if (this.datas != null)
        {
            this.datas.clear();
            this.datas.ensureCapacity(datasLen);
        }
        else
        {
            this.datas = new IntObjectMap <ActivityData>(datasLen);
        }

        IntObjectMap <ActivityData> datasT = this.datas;

        for (int datasI = datasLen - 1; datasI >= 0; --datasI)
        {
            ActivityData datasV;
            BaseData     datasVT = stream.readDataFullNotNull();
            if (datasVT != null)
            {
                if (datasVT is ActivityData)
                {
                    datasV = (ActivityData)datasVT;
                }
                else
                {
                    datasV = new ActivityData();
                    if (!(datasVT.GetType().IsAssignableFrom(typeof(ActivityData))))
                    {
                        stream.throwTypeReadError(typeof(ActivityData), datasVT.GetType());
                    }
                    datasV.shadowCopy(datasVT);
                }
            }
            else
            {
                datasV = null;
            }

            datasT.put(datasV.id, datasV);
        }

        stream.endReadObj();
    }