using System;
using System.IO;
namespace Jellyfin.Extensions;
///
/// A custom StreamWriter which supports setting a IFormatProvider.
///
public class FormattingStreamWriter : StreamWriter
{
private readonly IFormatProvider _formatProvider;
///
/// Initializes a new instance of the class.
///
/// The stream to write to.
/// The format provider to use.
public FormattingStreamWriter(Stream stream, IFormatProvider formatProvider)
: base(stream)
{
_formatProvider = formatProvider;
}
///
/// Initializes a new instance of the class.
///
/// The complete file path to write to.
/// The format provider to use.
public FormattingStreamWriter(string path, IFormatProvider formatProvider)
: base(path)
{
_formatProvider = formatProvider;
}
///
public override IFormatProvider FormatProvider
=> _formatProvider;
}