public static System.IO.Stream CreateTemporaryStorage(System.Func<int, byte[]> acquireBuffer, System.Action<byte[]> releaseBuffer) { var temporaryDataStorage = new TemporaryDataStorage(acquireBuffer, releaseBuffer); System.IO.Stream stream = temporaryDataStorage.OpenWriteStream(false); temporaryDataStorage.Release(); return stream; }
internal Stream GetWriteStream() { TemporaryDataStorage temporaryDataStorage = new TemporaryDataStorage(); this.SetStorage(temporaryDataStorage, 0L, long.MaxValue); return(temporaryDataStorage.OpenWriteStream(true)); }
public static Stream Create() { TemporaryDataStorage temporaryDataStorage = new TemporaryDataStorage(); Stream result = temporaryDataStorage.OpenWriteStream(false); temporaryDataStorage.Release(); return(result); }
internal void Load(CalendarReader reader, Charset charset) { while (reader.ReadNextComponent()) { if (ComponentId.VEvent == reader.ComponentId) { CalendarPropertyReader propertyReader = reader.PropertyReader; while (propertyReader.ReadNextProperty()) { PropertyId propertyId = propertyReader.PropertyId; if (this.dirty.ContainsKey(propertyId) && !this.properties.ContainsKey(propertyId)) { if (PropertyId.Description == propertyId || PropertyId.Comment == propertyId) { byte[] array = null; TemporaryDataStorage temporaryDataStorage = new TemporaryDataStorage(); using (Stream stream = temporaryDataStorage.OpenWriteStream(true)) { using (Stream valueReadStream = propertyReader.GetValueReadStream()) { DataStorage.CopyStreamToStream(valueReadStream, stream, long.MaxValue, ref array); } } BodyData bodyData = new BodyData(); bodyData.SetFormat(BodyFormat.Text, InternalBodyFormat.Text, charset); bodyData.SetStorage(temporaryDataStorage, 0L, long.MaxValue); temporaryDataStorage.Release(); this.properties[propertyId] = bodyData; } else if (PropertyId.Attendee == propertyId) { CalendarParameterReader parameterReader = propertyReader.ParameterReader; while (parameterReader.ReadNextParameter()) { if (parameterReader.ParameterId == ParameterId.ParticipationStatus) { this.properties[propertyId] = parameterReader.ReadValue(); } } } else { this.properties[propertyId] = propertyReader.ReadValue(); } } } } if (ComponentId.VCalendar == reader.ComponentId) { CalendarPropertyReader propertyReader2 = reader.PropertyReader; while (propertyReader2.ReadNextProperty()) { PropertyId propertyId2 = propertyReader2.PropertyId; if (PropertyId.Method == propertyId2) { this.properties[propertyId2] = propertyReader2.ReadValue(); } } } } }