Пример #1
0
        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));
        }
Пример #2
0
        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");
        }