public override void WriteJson(JsonWriter Writer, object Value, JsonSerializer Serializer) { StreamEntry StreamEntry = (StreamEntry)Value; if (StreamEntry != null) { StreamEntry.Save().WriteTo(Writer); } else { Writer.WriteNull(); } }
protected sealed override void Save(LogicJSONObject jsonObject) { LogicJSONArray ownerIdArray = new LogicJSONArray(2); ownerIdArray.Add(new LogicJSONNumber(this.OwnerId.GetHigherInt())); ownerIdArray.Add(new LogicJSONNumber(this.OwnerId.GetLowerInt())); jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_OWNER_ID, ownerIdArray); jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_CREATE_TIME, new LogicJSONString(this.CreateTime.ToString("O"))); jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_TYPE, new LogicJSONNumber((int)this.Type)); switch (this.Type) { case StreamType.ALLIANCE: { LogicJSONObject entryObject = new LogicJSONObject(); StreamEntry entry = (StreamEntry)this.Entry; jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_ENTRY_TYPE, new LogicJSONNumber((int)entry.GetStreamEntryType())); jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_ENTRY, entryObject); entry.Save(entryObject); break; } case StreamType.AVATAR: { LogicJSONObject entryObject = new LogicJSONObject(); AvatarStreamEntry entry = (AvatarStreamEntry)this.Entry; jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_ENTRY_TYPE, new LogicJSONNumber((int)entry.GetAvatarStreamEntryType())); jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_ENTRY, entryObject); entry.Save(entryObject); break; } case StreamType.REPLAY: { LogicJSONObject entryObject = new LogicJSONObject(); ReplayStreamEntry entry = (ReplayStreamEntry)this.Entry; jsonObject.Put(StreamDocument.JSON_ATTRIBUTE_ENTRY, entryObject); entry.Save(entryObject); break; } } }