/// <summary> /// Creates an instance of TinyFileStream. /// </summary> /// <param name="fileSystem">TinyFileSystem instance on which the file this stream exposes exists.</param> /// <param name="fileRef">The file to expose through the TinyFileStream.</param> /// <remarks> /// Instances of this class should never be created directly. The should be created by calls to Create or Open /// on the TinyFileSystem instance. /// </remarks> internal TinyFileStream(TinyFileSystem fileSystem, FileRef fileRef) { _fs = fileSystem; _fileRef = fileRef; _filePointer = 0; _fileRef.OpenCount++; }
/// <summary> /// Dispose the TinyFileStream. /// </summary> /// <param name="disposing">true if being disposed from a call to Dispose otherwise false if called from the finalizer.</param> protected override void Dispose(bool disposing) { if (_fileRef != null) { _fileRef.OpenCount--; _fileRef = null; _fs = null; } base.Dispose(disposing); }