Exemplo n.º 1
0
 public override void Decode(ByteStream stream)
 {
     if (this.Success)
     {
         this.Entry = AvatarStreamEntryFactory.CreateStreamEntryByType((AvatarStreamEntryType)stream.ReadVInt());
         this.Entry.Decode(stream);
     }
 }
Exemplo n.º 2
0
        public override void Decode(ByteStream stream)
        {
            if (this.Success)
            {
                this.StreamList = new LogicArrayList <AvatarStreamEntry>();

                for (int i = stream.ReadVInt() - 1; i >= 0; i--)
                {
                    AvatarStreamEntry streamEntry = AvatarStreamEntryFactory.CreateStreamEntryByType((AvatarStreamEntryType)stream.ReadVInt());
                    streamEntry.Decode(stream);
                    this.StreamList.Add(streamEntry);
                }
            }
        }
        protected sealed override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONArray ownerIdArray = jsonObject.GetJSONArray(StreamDocument.JSON_ATTRIBUTE_OWNER_ID);

            this.OwnerId    = new LogicLong(ownerIdArray.GetJSONNumber(0).GetIntValue(), ownerIdArray.GetJSONNumber(1).GetIntValue());
            this.CreateTime = DateTime.Parse(jsonObject.GetJSONString(StreamDocument.JSON_ATTRIBUTE_CREATE_TIME).GetStringValue());
            this.Type       = (StreamType)jsonObject.GetJSONNumber(StreamDocument.JSON_ATTRIBUTE_TYPE).GetIntValue();

            switch (this.Type)
            {
            case StreamType.ALLIANCE:
            {
                StreamEntry entry = StreamEntryFactory.CreateStreamEntryByType((StreamEntryType)jsonObject.GetJSONNumber(StreamDocument.JSON_ATTRIBUTE_ENTRY_TYPE).GetIntValue());
                entry.Load(jsonObject.GetJSONObject(StreamDocument.JSON_ATTRIBUTE_ENTRY));
                entry.SetId(this.Id);
                this.Entry = entry;
                break;
            }

            case StreamType.AVATAR:
            {
                AvatarStreamEntry entry =
                    AvatarStreamEntryFactory.CreateStreamEntryByType((AvatarStreamEntryType)jsonObject.GetJSONNumber(StreamDocument.JSON_ATTRIBUTE_ENTRY_TYPE).GetIntValue());
                entry.Load(jsonObject.GetJSONObject(StreamDocument.JSON_ATTRIBUTE_ENTRY));
                entry.SetId(this.Id);
                this.Entry = entry;
                break;
            }

            case StreamType.REPLAY:
            {
                ReplayStreamEntry entry = new ReplayStreamEntry();
                entry.Load(jsonObject.GetJSONObject(StreamDocument.JSON_ATTRIBUTE_ENTRY));
                this.Entry = entry;
                break;
            }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 ///     Decodes this instance.
 /// </summary>
 public override void Decode()
 {
     base.Decode();
     this._entry = AvatarStreamEntryFactory.CreateStreamEntryByType(this.Stream.ReadVInt());
     this._entry.Decode(this.Stream);
 }
 public override void Decode(ByteStream stream)
 {
     this.OwnerId = stream.ReadLong();
     this.Entry   = AvatarStreamEntryFactory.CreateStreamEntryByType((AvatarStreamEntryType)stream.ReadVInt());
     this.Entry.Decode(stream);
 }