/// <summary> /// Disposes the <see cref="FlacFile" /> instance and disposes the underlying stream. /// </summary> /// <param name="disposing"> /// True to release both managed and unmanaged resources; false to release only unmanaged /// resources. /// </param> private void Dispose(bool disposing) { lock (_bufferLock) { if (!_disposed) { if (_frame != null) { _frame.Dispose(); _frame = null; } if (_stream != null && !(!_stream.CanRead && !_stream.CanWrite) && _closeStream) { _stream.Dispose(); } _disposed = true; } } }
/// <summary> /// Creates a new instance of the <see cref="FlacFrame"/> class based on the specified <paramref name="stream"/> and some basic stream information. /// </summary> /// <param name="stream">The stream which contains the flac frame.</param> /// <param name="streamInfo">Some basic information about the flac stream.</param> /// <returns>A new instance of the <see cref="FlacFrame"/> class.</returns> public static FlacFrame FromStream(Stream stream, FlacMetadataStreamInfo streamInfo) { var frame = new FlacFrame(stream, streamInfo); return frame; //return frame.HasError ? null : frame; }
/// <summary> /// Creates a new instance of the <see cref="FlacFrame"/> class based on the specified <paramref name="stream"/>. /// </summary> /// <param name="stream">The stream which contains the flac frame.</param> /// <returns>A new instance of the <see cref="FlacFrame"/> class.</returns> public static FlacFrame FromStream(Stream stream) { var frame = new FlacFrame(stream); return frame; //return frame.HasError ? null : frame; }