/// <summary> /// Clears all buffers for this stream and causes any buffered data to be written /// to the underlying device. /// </summary> public override void Flush() { if (TheIStream != null) { TheIStream.Commit(0 /*STGC_DEFAULT*/); } else { TheStream.Flush(); } }
/// <summary> /// Closes the current stream and releases any resources /// (such as the Stream) associated with the current IStream. /// </summary> /// <remarks> /// This method is not a member in IStream. /// </remarks> public override void Close() { if (TheStream != null) { TheStream.Close(); } else { TheIStream.Commit(0 /*STGC_DEFAULT*/); // Marshal.ReleaseComObject(TheIStream); // Investigate this because we cannot release an IStream to the stash file } GC.SuppressFinalize(this); }
/// <summary> /// Ensures that any changes made to an stream object that is open in transacted /// mode are reflected in the parent storage. /// </summary> /// <remarks> /// The <paramref name="grfCommitFlags"/> parameter is not used and this method only does Stream.Flush() /// </remarks> /// <param name="grfCommitFlags">Controls how the changes for the stream object are committed. /// See the STGC enumeration for a definition of these values.</param> ///<exception cref="IOException">An I/O error occurs.</exception> public void Commit(int grfCommitFlags) { // Clears all buffers for this stream and causes any buffered data to be written // to the underlying device. if (TheStream != null) { TheStream.Flush(); } else { TheIStream.Commit(grfCommitFlags); } }