/// <summary> /// Disposes of underlying resources. /// </summary> /// <param name="disposing">Set to <c>true</c> if called within Dispose(), /// else <c>false</c>.</param> protected override void Dispose(bool disposing) { try { if (disposing) { if (_file != null) { _file.Dispose(); } _file = null; } } finally { base.Dispose(disposing); } }
/// <summary> /// Initializes a new instance of the Disc class. /// </summary> /// <param name="path">The path to the disc image</param> /// <param name="access">The access requested to the disk</param> public Disc(string path, FileAccess access) { FileShare share = (access == FileAccess.Read) ? FileShare.Read : FileShare.None; _file = new DiscImageFile(new FileStream(path, FileMode.Open, access, share), Ownership.Dispose, OpticalFormat.None); }
/// <summary> /// Initializes a new instance of the Disc class. /// </summary> /// <param name="path">The path to the disc image</param> public Disc(string path) { _file = new DiscImageFile(new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None), Ownership.Dispose, OpticalFormat.None); }
/// <summary> /// Initializes a new instance of the Disc class. /// </summary> /// <param name="stream">The stream to read</param> /// <param name="ownsStream">Indicates if the new instance should control the lifetime of the stream.</param> /// <param name="format">The disk image format</param> public Disc(Stream stream, Ownership ownsStream, OpticalFormat format) { _file = new DiscImageFile(stream, ownsStream, format); }