public override void Read(Stream stream, int count, FrameContent content) { CodecState state = new CodecState(); CodecItem codecItem = CodecItemByFrameId(FrameId); (content as FrameContentText).Text = codecItem.Read(state, stream) as string; }
public override void Write(Stream stream, FrameContent content) { CodecState state = new CodecState(); CodecItem codecItem = CodecItemByFrameId(FrameId); codecItem.Write(state, stream, (content as FrameContentText).Text); }
private static CodecItem CodecItemByFrameId(string frameId) { if (!codecItemsByFrameId.ContainsKey(frameId)) { codecItemsByFrameId[frameId] = new CodecItem( CreateSerializerByFrameId(frameId), CreateConverterByFrameId(frameId), CodecItem.Dsts.Content, ContentPropertyNameByFrameId(frameId)); } return(codecItemsByFrameId[frameId]); }
public override void Read(Stream stream, int count, FrameContent content) { state.ItemCount = codecItems.Count; for (state.ItemIndex = 0; state.ItemIndex < state.ItemCount; state.ItemIndex++) { CodecItem entry = codecItems[state.ItemIndex]; object value = entry.Read(state, stream); object target = ObjectByTarget(entry.DestinationObject, content); SetProperty(PropInfo(target, entry.PropertyName), target, value); } }