using System;
using System.IO;
namespace Dpz.Core.Infrastructure;
public class TaglibFileForStream: TagLib.File.IFileAbstraction
{
public TaglibFileForStream(Stream inputStream,string fileName)
{
var stream = new MemoryStream();
if (inputStream.Position > 0)
{
inputStream.Position = 0;
}
inputStream.CopyTo(stream);
ReadStream = stream;
Name = fileName;
}
public void CloseStream(Stream stream)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
stream.Close();
}
public string Name { get; }
public Stream ReadStream { get; }
public Stream WriteStream => throw new Exception($"type:{this} does not support writhing!");
}