mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 18:15:44 +00:00
24 lines
492 B
C#
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;
|
|
}
|
|
}
|