From 5ae326074f2322f22e11ca1d18de2ae8a229a793 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sun, 7 Jan 2024 22:08:21 +0100 Subject: [PATCH] Document: Fix GenerationProportion --- Elwig/Documents/Document.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Elwig/Documents/Document.cs b/Elwig/Documents/Document.cs index d29699e..6295a9c 100644 --- a/Elwig/Documents/Document.cs +++ b/Elwig/Documents/Document.cs @@ -97,10 +97,10 @@ namespace Elwig.Documents { await File.WriteAllTextAsync(tmpHtml.FilePath, await doc.Render(), Utils.UTF8); tmpHtmls.Add(tmpHtml); i++; - progress?.Report(GenerationProportion * i / n); + progress?.Report(GenerationProportion * 100 * i / n); } - progress?.Report(GenerationProportion); - await Pdf.Convert(tmpHtmls.Select(f => f.FileName), pdf.FileName, DoubleSided, new Progress(v => progress?.Report(GenerationProportion + v * (1 - GenerationProportion)))); + progress?.Report(GenerationProportion * 100); + await Pdf.Convert(tmpHtmls.Select(f => f.FileName), pdf.FileName, DoubleSided, new Progress(v => progress?.Report(GenerationProportion * 100 + v * (1 - GenerationProportion)))); foreach (var tmp in tmpHtmls) { tmp.Dispose(); }