/// <summary> /// update the schedule info of this record. /// </summary> /// <param name="item"></param> public void UpdateSchedule(RepeatItem<TValue> item) { byte[] bytes = this.ToRecordBytes(item); int bytelen = bytes.Length; lock (_object) { if (item.id > 0) { ContentStream.Position = item.id; ContentStream.Write(bytes, 0, bytelen); } var currentitem = this.RepeatTaskList.Find(o => o.id == item.id); if (currentitem != null) { currentitem = item; } } }
/// <summary> /// Add new task object to the content block. /// </summary> /// <param name="repeattask"></param> /// <returns></returns> private long AddTask(TValue repeattask) { byte[] bytes = this.ValueConverter.ToByte(repeattask); int contentbytelen = bytes.Length; lock (_object) { Int64 currentposition = this.ContentStream.Length; ContentStream.Position = currentposition; ContentStream.WriteByte(startbyteone); ContentStream.WriteByte(startbytetwo); ContentStream.Write(BitConverter.GetBytes(contentbytelen), 0, 4); ContentStream.Write(bytes, 0, contentbytelen); return(currentposition); } }
public override void Write(byte[] buffer, int offset, int count) { CreateStream(); ContentStream.Write(buffer, offset, count); }
public override void Write(byte[] input, ContentStream writer, WriterContext ctx) { writer.Write(input); }