Move TempFile to own class

This commit is contained in:
2023-03-11 15:23:52 +01:00
parent aca39be8d4
commit e3e30bfc56
7 changed files with 51 additions and 57 deletions

View File

@ -10,7 +10,7 @@ using WGneu.Helpers;
namespace WGneu.Documents {
public abstract class Document : IDisposable {
private Utils.TemporaryFile? PdfFile = null;
private TempFile? PdfFile = null;
public Document(string title) {
Title = title;
@ -51,8 +51,8 @@ namespace WGneu.Documents {
}
public async Task Generate() {
var pdf = new Utils.TemporaryFile("pdf");
using (var tmpHtml = new Utils.TemporaryFile("html")) {
var pdf = new TempFile("pdf");
using (var tmpHtml = new TempFile("html")) {
await File.WriteAllTextAsync(tmpHtml.FilePath, await Render());
await Pdf.Convert(tmpHtml.FilePath, pdf.FilePath);
}