private bool WritePropertyStreamData(PersistablePropertyBag propertyBag, NativeStorePropertyDefinition property, out long totalBytesRead) { totalBytesRead = 0L; try { using (Stream stream = propertyBag.OpenPropertyStream(property, PropertyOpenMode.ReadOnly)) { using (Stream stream2 = this.tnefWriter.StartStreamProperty(property)) { totalBytesRead = Util.StreamHandler.CopyStreamData(stream, stream2); } } } catch (ObjectNotFoundException) { } return(false); }
private void StreamProperty(NativeStorePropertyDefinition property, PersistablePropertyBag propertyBag) { Stream stream = null; try { stream = propertyBag.OpenPropertyStream(property, PropertyOpenMode.ReadOnly); this.StreamProperty(property, stream); } catch (ObjectNotFoundException) { } finally { if (stream != null) { stream.Dispose(); } } }
internal static void CopyProperty(PersistablePropertyBag source, PropertyDefinition property, PersistablePropertyBag destination) { object obj = source.TryGetProperty(property); PropertyError propertyError = obj as PropertyError; if (propertyError == null) { destination[property] = obj; return; } if (PropertyError.IsPropertyValueTooBig(propertyError)) { Stream stream; Stream readStream = stream = source.OpenPropertyStream(property, PropertyOpenMode.ReadOnly); try { Stream stream2; Stream writeStream = stream2 = destination.OpenPropertyStream(property, PropertyOpenMode.Create); try { Util.StreamHandler.CopyStreamData(readStream, writeStream); } finally { if (stream2 != null) { ((IDisposable)stream2).Dispose(); } } } finally { if (stream != null) { ((IDisposable)stream).Dispose(); } } } }