public Stream CreateTemporaryFile(TemporaryFileExtension tmpext) { var guid = Guid.NewGuid(); var fname = $"{guid:D}.{ExtensionToString(tmpext)}"; var fi = new FileInfo(Path.Combine(this.Temporary.FullName, fname)); this.Logger.LogInformation("Creating temporary file '{0}'", fi.FullName); return(File.Create(fi.FullName, 4096, FileOptions.DeleteOnClose | FileOptions.Asynchronous)); }
private static string ExtensionToString(TemporaryFileExtension ext) { switch (ext) { case TemporaryFileExtension.Nupkg: return("nupkg"); case TemporaryFileExtension.Nuspec: return("nuspec"); case TemporaryFileExtension.Pdb: return("pdb"); } return("tmp"); }