FFMpegCore/FFMpegCore.Test/TemporaryFile.cs
2025-10-16 12:38:57 +02:00

24 lines
492 B
C#

namespace FFMpegCore.Test;
public class TemporaryFile : IDisposable
{
private readonly string _path;
public TemporaryFile(string filename)
{
_path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}-{filename}");
}
public void Dispose()
{
if (File.Exists(_path))
{
File.Delete(_path);
}
}
public static implicit operator string(TemporaryFile temporaryFile)
{
return temporaryFile._path;
}
}