| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
using System; |
| 5 |
using System.IO; |
| 6 |
using System.Runtime.InteropServices; |
| 7 |
using Microsoft.Win32.SafeHandles; |
| 8 |
|
| 9 |
namespace Microsoft.NuGet.Build.Tasks.Tests.Helpers |
| 10 |
{ |
| 11 |
public sealed class DisposableFile : TempFile, IDisposable |
| 12 |
{ |
| 13 |
public DisposableFile(string path) |
| 14 |
: base(path) |
| 15 |
{ |
| 16 |
} |
| 17 |
|
| 18 |
public DisposableFile(TempRoot root, string prefix = null, string extension = null, string directory = null, string callerSourcePath = null, int callerLineNumber = 0) |
| 19 |
: base(root, prefix, extension, directory, callerSourcePath, callerLineNumber) |
| 20 |
{ |
| 21 |
} |
| 22 |
|
| 23 |
public void Dispose() |
| 24 |
{ |
| 25 |
if (Path != null && File.Exists(Path)) |
| 26 |
{ |
| 27 |
File.Delete(Path); |
| 28 |
} |
| 29 |
} |
| 30 |
} |
| 31 |
} |