Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Show engine versions, what each engine does, and download speed

KnifeLemoncd6707c46734
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index ca855ad4..08f95a5b 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -55,6 +55,27 @@
"engine.reason.error": "Error while checking",
"engine.reason.unsupported_platform": "Not available on this platform",
"engine.reason.needs_package": "Needs {0} — install it in Settings → Engines",
+ "engine.magick.description": "Images: JPG, PNG, WEBP, AVIF, HEIC, TIFF, GIF, BMP, ICO, PSD, TGA, JPEG XL, camera RAW and more — re-encoded with your preset's quality, size and DPI.",
+ "engine.pdfium.description": "Renders PDF pages to PNG, JPG and TIFF (also multi-page TIFF and GIF) at the preset's resolution.",
+ "engine.pdfsharp.description": "Makes PDFs from images and merges, splits or cuts page ranges out of PDFs.",
+ "engine.rhwp.description": "Renders HWP/HWPX to PDF and converts HWP ↔ HWPX. Every conversion to PDF through the HWPX writer (DOCX, XLSX, PPTX, Markdown, e-books…) is drawn by it.",
+ "engine.unhwp.description": "Extracts text, Markdown and HTML from HWP and HWPX.",
+ "engine.markdown.description": "Markdown → HTML and plain text.",
+ "engine.spreadsheet.description": "XLSX ↔ CSV, one CSV per sheet, with the numbers and dates Excel shows.",
+ "engine.ooxml.description": "Macro-enabled files and templates (DOCM, DOTX, XLSM, XLTX, PPTM, POTX, PPSX) ↔ DOCX, XLSX and PPTX; macros are removed.",
+ "engine.hwpx-writer.description": "Reads Word, Excel, PowerPoint, PDF, HTML, Markdown and text files and writes HWPX — the first step of every document conversion to PDF, without Office or LibreOffice.",
+ "engine.docx-writer.description": "Writes Word documents (DOCX) from PDF, HWPX, Markdown, HTML, text and e-books.",
+ "engine.vector.description": "SVG and SVGZ to vector PDF and to images; Illustrator files saved with PDF content.",
+ "engine.icns.description": "macOS app icons (ICNS) from and to images.",
+ "engine.font.description": "Fonts: TTF, OTF, WOFF, WOFF2 and EOT into each other.",
+ "engine.cad.description": "AutoCAD drawings: DWG ↔ DXF, and both to PDF, SVG and PNG.",
+ "engine.archive.description": "Extracts ZIP, 7Z, RAR, TAR, GZ, ISO and other archives, repacks them as ZIP, 7Z or TAR.GZ and compresses files into one archive (7-Zip).",
+ "engine.ebook.description": "E-books: EPUB, MOBI, AZW3, FB2 and comics (CBZ, CBR) to PDF, EPUB, DOCX and text; documents to EPUB.",
+ "engine.ffmpeg.description": "Video and audio: MP4, MOV, MKV, WEBM, AVI, MP3, M4A, WAV, FLAC and more; extracts the sound of videos and makes GIFs.",
+ "engine.pandoc.description": "Markdown, HTML, reStructuredText and LaTeX ↔ Word, ODT and RTF.",
+ "engine.ghostscript.description": "EPS, PostScript and older Illustrator files to PDF and images; PDF to EPS and PS.",
+ "engine.calibre.description": "Rare e-book formats (LIT, LRF, CHM, PDB, RB…) and Kindle output (MOBI, AZW3).",
+ "engine.libreoffice.description": "Older and less common office formats — DOC, XLS, PPT, OpenDocument, Pages, Keynote, WordPerfect, Visio, CorelDRAW… — and saving as DOCX or ODT.",
"profile.images": "Images",
"profile.pdf": "PDF",
@@ -241,6 +262,10 @@
"engines.package.pandoc.name": "Pandoc (HTML and Markdown ↔ Word)",
"engines.package.pandoc.description": "Markdown ↔ DOCX, ODT and RTF, and HTML, ODT and RTF → HWPX. Markdown → PDF, HWPX, HTML and TXT, and DOCX → HWPX work without it.",
"engines.package.size": "Download {0} · {1} on disk",
+ "engines.progress_detail": "{0} of {1} · {2}/s · {3}",
+ "engines.eta.estimating": "estimating time left…",
+ "engines.eta.seconds": "{0} s left",
+ "engines.eta.minutes": "{0} min left",
"engines.install": "Install",
"engines.cancel": "Cancel",
"engines.remove": "Remove",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index c45e8822..cc9b00c3 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -55,6 +55,27 @@
"engine.reason.error": "확인 중 오류",
"engine.reason.unsupported_platform": "이 플랫폼에서는 사용할 수 없음",
"engine.reason.needs_package": "{0} 필요 — 설정 → 변환 엔진에서 설치",
+ "engine.magick.description": "이미지: JPG, PNG, WEBP, AVIF, HEIC, TIFF, GIF, BMP, ICO, PSD, TGA, JPEG XL, 카메라 RAW 등을 프리셋의 품질·크기·DPI로 변환해요.",
+ "engine.pdfium.description": "PDF 페이지를 PNG, JPG, TIFF(여러 페이지 TIFF·GIF 포함)로 프리셋 해상도에 맞춰 그려요.",
+ "engine.pdfsharp.description": "이미지로 PDF를 만들고, PDF를 합치거나 나누거나 원하는 페이지만 잘라내요.",
+ "engine.rhwp.description": "HWP/HWPX를 PDF로 그리고 HWP ↔ HWPX를 변환해요. HWPX 작성기를 거쳐 PDF가 되는 모든 변환(DOCX, XLSX, PPTX, 마크다운, 전자책…)도 이 엔진이 그려요.",
+ "engine.unhwp.description": "HWP와 HWPX에서 텍스트, 마크다운, HTML을 뽑아내요.",
+ "engine.markdown.description": "마크다운 → HTML, 텍스트.",
+ "engine.spreadsheet.description": "XLSX ↔ CSV. 시트마다 CSV 하나로, 엑셀에 보이는 숫자와 날짜 그대로 저장해요.",
+ "engine.ooxml.description": "매크로 포함 파일과 서식 파일(DOCM, DOTX, XLSM, XLTX, PPTM, POTX, PPSX) ↔ DOCX, XLSX, PPTX. 매크로는 지워요.",
+ "engine.hwpx-writer.description": "워드, 엑셀, 파워포인트, PDF, HTML, 마크다운, 텍스트 파일을 읽어 HWPX로 써요. 오피스나 LibreOffice 없이 문서를 PDF로 바꾸는 첫 단계예요.",
+ "engine.docx-writer.description": "PDF, HWPX, 마크다운, HTML, 텍스트, 전자책으로 워드 문서(DOCX)를 만들어요.",
+ "engine.vector.description": "SVG·SVGZ를 벡터 PDF와 이미지로, PDF 내용이 들어 있는 일러스트레이터 파일도 변환해요.",
+ "engine.icns.description": "macOS 앱 아이콘(ICNS)을 이미지로, 이미지를 ICNS로.",
+ "engine.font.description": "글꼴: TTF, OTF, WOFF, WOFF2, EOT를 서로 변환해요.",
+ "engine.cad.description": "오토캐드 도면: DWG ↔ DXF, 그리고 둘 다 PDF, SVG, PNG로.",
+ "engine.archive.description": "ZIP, 7Z, RAR, TAR, GZ, ISO 등 압축 파일을 풀고, ZIP·7Z·TAR.GZ로 다시 묶거나 여러 파일을 압축 파일 하나로 만들어요(7-Zip).",
+ "engine.ebook.description": "전자책: EPUB, MOBI, AZW3, FB2와 만화책(CBZ, CBR)을 PDF, EPUB, DOCX, 텍스트로, 문서는 EPUB으로 변환해요.",
+ "engine.ffmpeg.description": "동영상·오디오: MP4, MOV, MKV, WEBM, AVI, MP3, M4A, WAV, FLAC 등. 동영상에서 소리만 뽑거나 GIF도 만들어요.",
+ "engine.pandoc.description": "마크다운, HTML, reStructuredText, LaTeX ↔ 워드, ODT, RTF.",
+ "engine.ghostscript.description": "EPS, 포스트스크립트, 예전 일러스트레이터 파일을 PDF와 이미지로, PDF를 EPS·PS로.",
+ "engine.calibre.description": "드문 전자책 형식(LIT, LRF, CHM, PDB, RB…)과 킨들용 출력(MOBI, AZW3).",
+ "engine.libreoffice.description": "DOC, XLS, PPT, 오픈도큐먼트, Pages, Keynote, 워드퍼펙트, Visio, CorelDRAW 같은 오래되었거나 드문 오피스 형식, 그리고 DOCX·ODT로 저장하기.",
"profile.images": "이미지",
"profile.pdf": "PDF",
@@ -241,6 +262,10 @@
"engines.package.pandoc.name": "Pandoc (HTML·마크다운 ↔ 워드)",
"engines.package.pandoc.description": "마크다운 ↔ DOCX·ODT·RTF 변환과 HTML·ODT·RTF → HWPX 변환을 추가합니다. 마크다운 → PDF·HWPX·HTML·TXT와 DOCX → HWPX는 없어도 됩니다.",
"engines.package.size": "다운로드 {0} · 설치 후 {1}",
+ "engines.progress_detail": "{0} / {1} · {2}/s · {3}",
+ "engines.eta.estimating": "남은 시간 계산 중…",
+ "engines.eta.seconds": "{0}초 남음",
+ "engines.eta.minutes": "{0}분 남음",
"engines.install": "설치",
"engines.cancel": "취소",
"engines.remove": "제거",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index de9260d8..e038d59b 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -55,6 +55,27 @@
"engine.reason.error": "检查时出错",
"engine.reason.unsupported_platform": "此平台不可用",
"engine.reason.needs_package": "需要 {0} — 在 设置 → 转换引擎 中安装",
+ "engine.magick.description": "图片:JPG、PNG、WEBP、AVIF、HEIC、TIFF、GIF、BMP、ICO、PSD、TGA、JPEG XL、相机 RAW 等,按预设的质量、尺寸和 DPI 转换。",
+ "engine.pdfium.description": "按预设分辨率将 PDF 页面渲染为 PNG、JPG、TIFF(也支持多页 TIFF 和 GIF)。",
+ "engine.pdfsharp.description": "用图片生成 PDF,合并、拆分 PDF 或截取指定页码。",
+ "engine.rhwp.description": "将 HWP/HWPX 渲染为 PDF,并在 HWP ↔ HWPX 之间转换。所有经 HWPX 写入器转为 PDF 的文件(DOCX、XLSX、PPTX、Markdown、电子书…)也由它渲染。",
+ "engine.unhwp.description": "从 HWP 和 HWPX 中提取文本、Markdown 和 HTML。",
+ "engine.markdown.description": "Markdown → HTML 和纯文本。",
+ "engine.spreadsheet.description": "XLSX ↔ CSV,每个工作表一个 CSV,数字和日期与 Excel 中显示的一致。",
+ "engine.ooxml.description": "启用宏的文件和模板(DOCM、DOTX、XLSM、XLTX、PPTM、POTX、PPSX)↔ DOCX、XLSX、PPTX,宏会被移除。",
+ "engine.hwpx-writer.description": "读取 Word、Excel、PowerPoint、PDF、HTML、Markdown 和文本文件并写成 HWPX——无需 Office 或 LibreOffice 将文档转为 PDF 的第一步。",
+ "engine.docx-writer.description": "用 PDF、HWPX、Markdown、HTML、文本和电子书生成 Word 文档(DOCX)。",
+ "engine.vector.description": "将 SVG、SVGZ 转为矢量 PDF 和图片;也支持包含 PDF 内容的 Illustrator 文件。",
+ "engine.icns.description": "macOS 应用图标(ICNS)与图片互转。",
+ "engine.font.description": "字体:TTF、OTF、WOFF、WOFF2 和 EOT 互相转换。",
+ "engine.cad.description": "AutoCAD 图纸:DWG ↔ DXF,并可转为 PDF、SVG 和 PNG。",
+ "engine.archive.description": "解压 ZIP、7Z、RAR、TAR、GZ、ISO 等压缩文件,重新打包为 ZIP、7Z 或 TAR.GZ,或把多个文件压缩成一个(7-Zip)。",
+ "engine.ebook.description": "电子书:EPUB、MOBI、AZW3、FB2 和漫画(CBZ、CBR)转为 PDF、EPUB、DOCX 和文本;文档转为 EPUB。",
+ "engine.ffmpeg.description": "视频和音频:MP4、MOV、MKV、WEBM、AVI、MP3、M4A、WAV、FLAC 等;可提取视频中的声音,也能制作 GIF。",
+ "engine.pandoc.description": "Markdown、HTML、reStructuredText、LaTeX ↔ Word、ODT、RTF。",
+ "engine.ghostscript.description": "EPS、PostScript 和旧版 Illustrator 文件转为 PDF 和图片;PDF 转为 EPS 和 PS。",
+ "engine.calibre.description": "少见的电子书格式(LIT、LRF、CHM、PDB、RB…)以及 Kindle 输出(MOBI、AZW3)。",
+ "engine.libreoffice.description": "较旧或少见的办公格式——DOC、XLS、PPT、OpenDocument、Pages、Keynote、WordPerfect、Visio、CorelDRAW 等——以及保存为 DOCX 或 ODT。",
"profile.images": "图片",
"profile.pdf": "PDF",
@@ -241,6 +262,10 @@
"engines.package.pandoc.name": "Pandoc(HTML 与 Markdown ↔ Word)",
"engines.package.pandoc.description": "支持 Markdown ↔ DOCX、ODT、RTF,以及 HTML、ODT、RTF → HWPX。Markdown → PDF、HWPX、HTML、TXT 和 DOCX → HWPX 无需此引擎。",
"engines.package.size": "下载 {0} · 占用 {1}",
+ "engines.progress_detail": "{0} / {1} · {2}/s · {3}",
+ "engines.eta.estimating": "正在估算剩余时间…",
+ "engines.eta.seconds": "剩余 {0} 秒",
+ "engines.eta.minutes": "剩余 {0} 分钟",
"engines.install": "安装",
"engines.cancel": "取消",
"engines.remove": "删除",
diff --git a/src/Filee.App/Services/EngineDownloadService.cs b/src/Filee.App/Services/EngineDownloadService.cs
index aa878c94..39982c9e 100644
--- a/src/Filee.App/Services/EngineDownloadService.cs
+++ b/src/Filee.App/Services/EngineDownloadService.cs
@@ -1,6 +1,7 @@
// Optional engine downloads for the UI: one observable state per package, one install at a time, and a catalog
// refresh when an engine appears or disappears so donut slices and routes update immediately.
+using System.Diagnostics;
using CommunityToolkit.Mvvm.ComponentModel;
using Filee.Core.Conversion;
using Filee.Core.Localization;
@@ -51,6 +52,10 @@ public sealed partial class EnginePackageState : ObservableObject
[NotifyPropertyChangedFor(nameof(StatusText))]
private string? _error;
+ /// <summary>"120 MB / 420 MB · 8.4 MB/s · 36 s left" while downloading, empty otherwise.</summary>
+ [ObservableProperty]
+ private string _progressDetail = "";
+
/// <summary>Ticked in the first-run setup.</summary>
[ObservableProperty]
private bool _selected;
@@ -78,6 +83,29 @@ public sealed partial class EnginePackageState : ObservableObject
public static string FormatBytes(long bytes) => bytes >= 1_000_000_000
? $"{bytes / 1_000_000_000.0:0.0} GB"
: $"{Math.Max(1, bytes / 1_000_000)} MB";
+
+ /// <summary>Download amounts and speeds with one decimal where it matters: "850 KB", "12.3 MB", "1.23 GB".</summary>
+ public static string FormatAmount(double bytes) => bytes switch
+ {
+ >= 1_000_000_000 => $"{bytes / 1_000_000_000:0.00} GB",
+ >= 100_000_000 => $"{bytes / 1_000_000:0} MB",
+ >= 1_000_000 => $"{bytes / 1_000_000:0.0} MB",
+ _ => $"{Math.Max(0, bytes / 1_000):0} KB",
+ };
+
+ /// <summary>Updates <see cref="ProgressDetail"/> from a download progress report.</summary>
+ internal void ShowTransfer(long done, long total, TransferRate rate)
+ {
+ var remaining = rate.Remaining(done, total);
+ var eta = remaining switch
+ {
+ null => _loc["engines.eta.estimating"],
+ { TotalSeconds: < 60 } time => _loc.Format("engines.eta.seconds", Math.Max(1, (int)Math.Ceiling(time.TotalSeconds))),
+ var time => _loc.Format("engines.eta.minutes", (int)Math.Ceiling(time.Value.TotalMinutes)),
+ };
+ ProgressDetail = _loc.Format("engines.progress_detail",
+ FormatAmount(done), FormatAmount(total), FormatAmount(rate.BytesPerSecond), eta);
+ }
}
public sealed class EngineDownloadService
@@ -130,12 +158,23 @@ public sealed class EngineDownloadService
try
{
// Progress<T> reports on the UI thread it was created on.
+ var clock = Stopwatch.StartNew();
+ var rate = new TransferRate();
var progress = new Progress<EngineInstallProgress>(p =>
{
if (!state.IsBusy)
return;
state.Status = p.Stage == EngineInstallStage.Downloading ? EnginePackageStatus.Downloading : EnginePackageStatus.Unpacking;
state.Progress = p.Fraction * 100;
+ if (p.Stage == EngineInstallStage.Downloading && p.BytesTotal > 0)
+ {
+ rate.Add(clock.Elapsed, p.BytesDone);
+ state.ShowTransfer(p.BytesDone, p.BytesTotal, rate);
+ }
+ else
+ {
+ state.ProgressDetail = "";
+ }
});
await Task.Run(() => _installer.InstallAsync(state.Package, progress, cancellation.Token), cancellation.Token);
}
@@ -161,6 +200,7 @@ public sealed class EngineDownloadService
finally
{
state.Cancellation = null;
+ state.ProgressDetail = "";
}
}
diff --git a/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs b/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs
index 27a0bb0e..334c1be8 100644
--- a/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs
@@ -18,8 +18,24 @@ public sealed class EngineItemViewModel(IConverter converter, EngineStatus statu
public string Name => Converter.DisplayName;
public bool IsAvailable { get; } = status.IsAvailable;
public string StatusText { get; } = status.IsAvailable ? loc["engines.available"] : loc[status.ReasonKey ?? "engines.unavailable"];
+
+ /// <summary>Path of the program or other technical detail, shown as a tooltip.</summary>
public string? Detail { get; } = status.Detail;
+
+ /// <summary>"Markdig 1.4.0", "0.8.6" — what the engine reports; empty for engines that aren't installed.</summary>
+ public string? Version { get; } = status.Version;
+
+ /// <summary>What the engine converts (engine.&lt;id&gt;.description), or null when there is no text for it.</summary>
+ public string? Description { get; } = Describe(loc, converter.Id);
+
public string Conversions { get; } = loc.Format("engines.conversions", converter.Edges.Count);
+
+ private static string? Describe(ILocalizer loc, string id)
+ {
+ var key = $"engine.{id}.description";
+ var text = loc[key];
+ return text == key ? null : text;
+ }
}
public sealed partial class EnginesPageViewModel : ObservableObject, IDisposable
diff --git a/src/Filee.App/Views/EngineSetupWindow.axaml b/src/Filee.App/Views/EngineSetupWindow.axaml
index 8952898f..1e831328 100644
--- a/src/Filee.App/Views/EngineSetupWindow.axaml
+++ b/src/Filee.App/Views/EngineSetupWindow.axaml
@@ -40,6 +40,7 @@
<TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Description}" />
<TextBlock Classes="caption" Text="{Binding Sizes}" />
<ProgressBar Classes="soft" Maximum="100" Value="{Binding Progress}" IsVisible="{Binding IsBusy}" Margin="0,4,0,0" />
+ <TextBlock Classes="caption" Text="{Binding ProgressDetail}" IsVisible="{Binding ProgressDetail, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
</StackPanel>
</DockPanel>
</Border>
diff --git a/src/Filee.App/Views/Pages/EnginesPage.axaml b/src/Filee.App/Views/Pages/EnginesPage.axaml
index 01d395d5..56d59e83 100644
--- a/src/Filee.App/Views/Pages/EnginesPage.axaml
+++ b/src/Filee.App/Views/Pages/EnginesPage.axaml
@@ -51,6 +51,7 @@
<TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Description}" />
<TextBlock Classes="caption" Text="{Binding Sizes}" />
<ProgressBar Classes="soft" Maximum="100" Value="{Binding Progress}" IsVisible="{Binding IsBusy}" Margin="0,4,0,0" />
+ <TextBlock Classes="caption" Text="{Binding ProgressDetail}" IsVisible="{Binding ProgressDetail, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
</StackPanel>
</DockPanel>
</Border>
@@ -85,15 +86,18 @@
Background="{DynamicResource SuccessBrush}" IsVisible="{Binding IsAvailable}" />
<Border DockPanel.Dock="Left" Width="10" Height="10" CornerRadius="999" Margin="2,0,12,0" VerticalAlignment="Center"
Background="{DynamicResource TextSecondaryBrush}" IsVisible="{Binding !IsAvailable}" />
- <StackPanel>
- <StackPanel Orientation="Horizontal" Spacing="10">
- <TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
- <Border Classes="badge">
+ <StackPanel Spacing="3" ToolTip.Tip="{Binding Detail}">
+ <WrapPanel Orientation="Horizontal">
+ <TextBlock FontWeight="SemiBold" Text="{Binding Name}" Margin="0,0,10,0" VerticalAlignment="Center" />
+ <Border Classes="badge" Margin="0,0,8,0">
<TextBlock Classes="caption" Text="{Binding StatusText}" />
</Border>
+ <TextBlock Classes="caption" VerticalAlignment="Center" Margin="0,0,8,0" Text="{Binding Version}"
+ IsVisible="{Binding Version, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
<TextBlock Classes="caption" VerticalAlignment="Center" Text="{Binding Conversions}" />
- </StackPanel>
- <TextBlock Classes="caption" Text="{Binding Detail}" TextTrimming="CharacterEllipsis" />
+ </WrapPanel>
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Description}"
+ IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
</StackPanel>
</DockPanel>
</StackPanel>
diff --git a/src/Filee.Core/Conversion/IConverter.cs b/src/Filee.Core/Conversion/IConverter.cs
index e5e32e1f..5d61f2b5 100644
--- a/src/Filee.Core/Conversion/IConverter.cs
+++ b/src/Filee.Core/Conversion/IConverter.cs
@@ -19,10 +19,11 @@ public readonly record struct ConversionEdge(string From, string To, int Cost =
/// <summary>Whether an engine can currently be used.</summary>
/// <param name="IsAvailable">True if conversions can run.</param>
/// <param name="ReasonKey">Localization key explaining why the engine is unavailable (e.g. <c>engine.reason.not_installed</c>).</param>
-/// <param name="Detail">Extra, non-localized detail such as a path or version.</param>
-public sealed record EngineStatus(bool IsAvailable, string? ReasonKey = null, string? Detail = null)
+/// <param name="Detail">Extra, non-localized detail such as the program's path (shown as a tooltip).</param>
+/// <param name="Version">Version label shown in Settings → Engines, e.g. <c>"Markdig 1.4.0"</c> or <c>"0.8.6"</c>.</param>
+public sealed record EngineStatus(bool IsAvailable, string? ReasonKey = null, string? Detail = null, string? Version = null)
{
- public static EngineStatus Available(string? detail = null) => new(true, null, detail);
+ public static EngineStatus Available(string? detail = null, string? version = null) => new(true, null, detail, version);
public static EngineStatus Unavailable(string reasonKey, string? detail = null) => new(false, reasonKey, detail);
}
diff --git a/src/Filee.Engines/Hwp/Hwpx/HwpxConverter.cs b/src/Filee.Engines/Hwp/Hwpx/HwpxConverter.cs
index 4c0b2c3a..3032a75d 100644
--- a/src/Filee.Engines/Hwp/Hwpx/HwpxConverter.cs
+++ b/src/Filee.Engines/Hwp/Hwpx/HwpxConverter.cs
@@ -42,9 +42,7 @@ public sealed class HwpxConverter : IConverter
public EngineStatus GetStatus()
{
_pandoc = PandocConverter.Locate();
- return EngineStatus.Available(_pandoc is null
- ? "DOCX, XLSX, PPTX, CSV, TXT, Markdown → HWPX. HTML, ODT and RTF need Pandoc."
- : $"DOCX, XLSX, PPTX, CSV, TXT, Markdown; HTML, ODT, RTF with Pandoc ({_pandoc})");
+ return EngineStatus.Available(_pandoc, EngineVersions.BuiltIn);
}
public async Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken)
diff --git a/src/Filee.Engines/Hwp/RhwpConverter.cs b/src/Filee.Engines/Hwp/RhwpConverter.cs
index 2670875b..65ebd9a9 100644
--- a/src/Filee.Engines/Hwp/RhwpConverter.cs
+++ b/src/Filee.Engines/Hwp/RhwpConverter.cs
@@ -28,7 +28,7 @@ public sealed class RhwpConverter : IConverter
public EngineStatus GetStatus()
{
_exe = Locate();
- return _exe is null ? EngineStatus.Unavailable("engine.reason.not_installed") : EngineStatus.Available(_exe);
+ return _exe is null ? EngineStatus.Unavailable("engine.reason.not_installed") : EngineStatus.Available(_exe, EngineVersions.Component("rhwp"));
}
public async Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken)
diff --git a/src/Filee.Engines/Hwp/UnhwpConverter.cs b/src/Filee.Engines/Hwp/UnhwpConverter.cs
index cdfada06..84fd928b 100644
--- a/src/Filee.Engines/Hwp/UnhwpConverter.cs
+++ b/src/Filee.Engines/Hwp/UnhwpConverter.cs
@@ -1,6 +1,7 @@
// HWP / HWPX → plain text, Markdown or HTML with Unhwp (MIT, native library shipped in the NuGet package).
using Filee.Core.Conversion;
+using Filee.Engines.Infrastructure;
using Markdig;
using Unhwp;
@@ -28,7 +29,9 @@ public sealed class UnhwpConverter : IConverter
var arch = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture;
var supported = arch == System.Runtime.InteropServices.Architecture.X64
|| (OperatingSystem.IsMacOS() && arch == System.Runtime.InteropServices.Architecture.Arm64);
- return supported ? EngineStatus.Available() : EngineStatus.Unavailable("engine.reason.unsupported_platform");
+ return supported
+ ? EngineStatus.Available(version: EngineVersions.Library("Unhwp", typeof(UnhwpDocument)))
+ : EngineStatus.Unavailable("engine.reason.unsupported_platform");
}
public Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken) =>
diff --git a/src/Filee.Engines/Infrastructure/EngineInstaller.cs b/src/Filee.Engines/Infrastructure/EngineInstaller.cs
index 4515af24..139413da 100644
--- a/src/Filee.Engines/Infrastructure/EngineInstaller.cs
+++ b/src/Filee.Engines/Infrastructure/EngineInstaller.cs
@@ -22,7 +22,9 @@ public enum EngineInstallStage
}
/// <summary>Progress of an install: <paramref name="Fraction"/> covers the whole package (0..1).</summary>
-public readonly record struct EngineInstallProgress(EngineInstallStage Stage, string ComponentId, double Fraction);
+/// <param name="BytesDone">Bytes of the package downloaded so far (all components).</param>
+/// <param name="BytesTotal">Download size of the components being installed.</param>
+public readonly record struct EngineInstallProgress(EngineInstallStage Stage, string ComponentId, double Fraction, long BytesDone = 0, long BytesTotal = 0);
/// <summary>Installs and removes <see cref="EnginePackage"/>s.</summary>
public sealed class EngineInstaller
@@ -67,11 +69,13 @@ public sealed class EngineInstaller
{
var offset = done;
var file = await DownloadAsync(component,
- bytes => progress?.Report(new EngineInstallProgress(EngineInstallStage.Downloading, component.Id, Math.Min(1, (offset + bytes) / (double)total))),
+ bytes => progress?.Report(new EngineInstallProgress(EngineInstallStage.Downloading, component.Id,
+ Math.Min(1, (offset + bytes) / (double)total), offset + bytes, total)),
cancellationToken);
try
{
- progress?.Report(new EngineInstallProgress(EngineInstallStage.Unpacking, component.Id, Math.Min(1, (offset + component.Size) / (double)total)));
+ progress?.Report(new EngineInstallProgress(EngineInstallStage.Unpacking, component.Id,
+ Math.Min(1, (offset + component.Size) / (double)total), offset + component.Size, total));
await UnpackAsync(component, file, cancellationToken);
}
finally
diff --git a/src/Filee.Engines/Infrastructure/EngineVersions.cs b/src/Filee.Engines/Infrastructure/EngineVersions.cs
new file mode 100644
index 00000000..727653c0
--- /dev/null
+++ b/src/Filee.Engines/Infrastructure/EngineVersions.cs
@@ -0,0 +1,29 @@
+// Version labels for Settings → Engines: the NuGet version of a library engine, Filee's own version for engines
+// built into it, and the pinned version of a bundled or downloaded program (engines.json).
+
+using System.Reflection;
+
+namespace Filee.Engines.Infrastructure;
+
+/// <summary>Builds the version text an engine reports in its <see cref="Filee.Core.Conversion.EngineStatus"/>.</summary>
+public static class EngineVersions
+{
+ /// <summary>"Markdig 1.4.0": the product name and version of the library that contains <paramref name="type"/>.</summary>
+ public static string Library(string name, Type type) => $"{name} {Of(type.Assembly)}";
+
+ /// <summary>"Filee 1.1.0" — for engines written as part of Filee.</summary>
+ public static string BuiltIn { get; } = $"Filee {Of(typeof(EngineVersions).Assembly)}";
+
+ /// <summary>The version engines.json pins for a bundled or downloaded component ("0.8.6"), or null.</summary>
+ public static string? Component(string componentId) =>
+ EngineDownloads.Components.TryGetValue(componentId, out var component) ? component.Version : null;
+
+ /// <summary>Informational version without the source revision ("14.17.2+a1b2c3" → "14.17.2").</summary>
+ private static string Of(Assembly assembly)
+ {
+ var version = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
+ ?? assembly.GetName().Version?.ToString(3)
+ ?? "?";
+ return version.Split('+')[0];
+ }
+}
diff --git a/src/Filee.Engines/Infrastructure/TransferRate.cs b/src/Filee.Engines/Infrastructure/TransferRate.cs
new file mode 100644
index 00000000..a60a236c
--- /dev/null
+++ b/src/Filee.Engines/Infrastructure/TransferRate.cs
@@ -0,0 +1,34 @@
+// Download speed and time left for engine downloads, averaged over the last seconds so the numbers shown while
+// downloading don't jump with every network hiccup.
+
+namespace Filee.Engines.Infrastructure;
+
+/// <summary>Speed of a transfer computed from "bytes so far" samples over a sliding time window.</summary>
+public sealed class TransferRate(TimeSpan window)
+{
+ private readonly Queue<(TimeSpan Time, long Bytes)> _samples = new();
+
+ public TransferRate()
+ : this(TimeSpan.FromSeconds(5))
+ {
+ }
+
+ /// <summary>Bytes per second over the window; 0 until enough time has passed to tell.</summary>
+ public double BytesPerSecond { get; private set; }
+
+ /// <summary>Records that <paramref name="bytes"/> bytes were transferred in total after <paramref name="elapsed"/>.</summary>
+ public void Add(TimeSpan elapsed, long bytes)
+ {
+ _samples.Enqueue((elapsed, bytes));
+ // Keep one sample older than the window as the start of the measured span.
+ while (_samples.Count > 2 && elapsed - _samples.ElementAt(1).Time >= window)
+ _samples.Dequeue();
+ var (startTime, startBytes) = _samples.Peek();
+ var seconds = (elapsed - startTime).TotalSeconds;
+ BytesPerSecond = seconds >= 0.5 ? Math.Max(0, bytes - startBytes) / seconds : BytesPerSecond;
+ }
+
+ /// <summary>Estimated time until <paramref name="total"/> bytes are reached, or null while the speed is unknown.</summary>
+ public TimeSpan? Remaining(long done, long total) =>
+ BytesPerSecond > 0 ? TimeSpan.FromSeconds(Math.Max(0, total - done) / BytesPerSecond) : null;
+}
diff --git a/src/Filee.Engines/Magick/MagickImageConverter.cs b/src/Filee.Engines/Magick/MagickImageConverter.cs
index e425a3b5..bfff0893 100644
--- a/src/Filee.Engines/Magick/MagickImageConverter.cs
+++ b/src/Filee.Engines/Magick/MagickImageConverter.cs
@@ -1,6 +1,7 @@
// Raster image ↔ raster image conversion with ImageMagick (Magick.NET, Apache-2.0).
using Filee.Core.Conversion;
+using Filee.Engines.Infrastructure;
using ImageMagick;
namespace Filee.Engines.Magick;
@@ -18,7 +19,12 @@ public sealed class MagickImageConverter : IConverter
select new ConversionEdge(source, target)).ToList();
public EngineStatus GetStatus() =>
- EngineStatus.Available($"ImageMagick {MagickNET.ImageMagickVersion}");
+ EngineStatus.Available(MagickNET.ImageMagickVersion,
+ $"{EngineVersions.Library("Magick.NET", typeof(MagickImage))} · ImageMagick {ImageMagickNumber()}");
+
+ /// <summary>"7.1.2-5" out of "ImageMagick 7.1.2-5 Q8 x64 …".</summary>
+ private static string ImageMagickNumber() =>
+ MagickNET.ImageMagickVersion.Split(' ').FirstOrDefault(part => part.Length > 0 && char.IsAsciiDigit(part[0])) ?? "?";
public Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken) =>
Task.Run<IReadOnlyList<string>>(() =>
diff --git a/src/Filee.Engines/Office/LibreOfficeConverter.cs b/src/Filee.Engines/Office/LibreOfficeConverter.cs
index 6235e846..aca92fb1 100644
--- a/src/Filee.Engines/Office/LibreOfficeConverter.cs
+++ b/src/Filee.Engines/Office/LibreOfficeConverter.cs
@@ -57,7 +57,8 @@ public sealed class LibreOfficeConverter : IConverter
Edges = BuildEdges(_hasHwpFilter);
return _soffice is null
? EngineStatus.Unavailable("engine.reason.not_installed")
- : EngineStatus.Available(_soffice + (_hasHwpFilter ? " (+H2Orestart)" : ""));
+ : EngineStatus.Available(_soffice, EngineVersions.Component("libreoffice")
+ + (_hasHwpFilter ? $" · H2Orestart {EngineVersions.Component("h2orestart")}" : ""));
}
public async Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken)
diff --git a/src/Filee.Engines/Office/PandocConverter.cs b/src/Filee.Engines/Office/PandocConverter.cs
index 2fa7e8c8..6e8a25e9 100644
--- a/src/Filee.Engines/Office/PandocConverter.cs
+++ b/src/Filee.Engines/Office/PandocConverter.cs
@@ -49,7 +49,7 @@ public sealed class PandocConverter : IConverter
public EngineStatus GetStatus()
{
_pandoc = Locate();
- return _pandoc is null ? EngineStatus.Unavailable("engine.reason.not_installed") : EngineStatus.Available(_pandoc);
+ return _pandoc is null ? EngineStatus.Unavailable("engine.reason.not_installed") : EngineStatus.Available(_pandoc, EngineVersions.Component("pandoc"));
}
public async Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken)
diff --git a/src/Filee.Engines/Office/SpreadsheetConverter.cs b/src/Filee.Engines/Office/SpreadsheetConverter.cs
index e28cf16c..5ac30b6b 100644
--- a/src/Filee.Engines/Office/SpreadsheetConverter.cs
+++ b/src/Filee.Engines/Office/SpreadsheetConverter.cs
@@ -2,6 +2,7 @@
// writer (sheets become 한글 tables), see HwpxConverter and SheetDocument.
using Filee.Core.Conversion;
+using Filee.Engines.Infrastructure;
using Filee.Engines.Office.Sheets;
namespace Filee.Engines.Office;
@@ -15,7 +16,8 @@ public sealed class SpreadsheetConverter : IConverter
public IReadOnlyList<ConversionEdge> Edges { get; } = [new("xlsx", "csv"), new("csv", "xlsx")];
- public EngineStatus GetStatus() => EngineStatus.Available("XLSX ↔ CSV");
+ public EngineStatus GetStatus() =>
+ EngineStatus.Available(version: $"{EngineVersions.BuiltIn} · {EngineVersions.Library("ExcelNumberFormat", typeof(ExcelNumberFormat.NumberFormat))}");
public Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken) =>
Task.Run<IReadOnlyList<string>>(() =>
diff --git a/src/Filee.Engines/Pdf/PdfSharpConverter.cs b/src/Filee.Engines/Pdf/PdfSharpConverter.cs
index ad4e62af..233645d7 100644
--- a/src/Filee.Engines/Pdf/PdfSharpConverter.cs
+++ b/src/Filee.Engines/Pdf/PdfSharpConverter.cs
@@ -2,6 +2,7 @@
using Filee.Core.Conversion;
using Filee.Core.Presets;
+using Filee.Engines.Infrastructure;
using Filee.Engines.Magick;
using ImageMagick;
using PdfSharp.Drawing;
@@ -26,7 +27,7 @@ public sealed class PdfSharpConverter : IConverter, IPdfMerger
new("pdf", "pdf"),
];
- public EngineStatus GetStatus() => EngineStatus.Available();
+ public EngineStatus GetStatus() => EngineStatus.Available(version: EngineVersions.Library("PDFsharp", typeof(PdfDocument)));
public Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken) =>
Task.Run(() => step.From == "pdf"
diff --git a/src/Filee.Engines/Pdf/PdfiumConverter.cs b/src/Filee.Engines/Pdf/PdfiumConverter.cs
index 02c1b0f9..883be1d9 100644
--- a/src/Filee.Engines/Pdf/PdfiumConverter.cs
+++ b/src/Filee.Engines/Pdf/PdfiumConverter.cs
@@ -1,6 +1,7 @@
// Renders PDF pages to raster images with PDFium (via PDFtoImage, MIT / PDFium BSD-3).
using Filee.Core.Conversion;
+using Filee.Engines.Infrastructure;
using Filee.Engines.Magick;
using ImageMagick;
using PDFtoImage;
@@ -26,7 +27,7 @@ public sealed class PdfiumConverter : IConverter
public IReadOnlyList<ConversionEdge> Edges { get; } =
ImageEncoder.Writable.Select(target => new ConversionEdge("pdf", target)).ToList();
- public EngineStatus GetStatus() => EngineStatus.Available();
+ public EngineStatus GetStatus() => EngineStatus.Available(version: EngineVersions.Library("PDFtoImage", typeof(Conversion)));
public Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken) =>
Task.Run<IReadOnlyList<string>>(() =>
diff --git a/src/Filee.Engines/Text/MarkdownConverter.cs b/src/Filee.Engines/Text/MarkdownConverter.cs
index 9e698700..6e56ceb1 100644
--- a/src/Filee.Engines/Text/MarkdownConverter.cs
+++ b/src/Filee.Engines/Text/MarkdownConverter.cs
@@ -6,6 +6,7 @@ using System.Net;
using System.Text;
using Filee.Core.Conversion;
using Filee.Engines.Hwp.Hwpx;
+using Filee.Engines.Infrastructure;
using Markdig;
using Markdig.Renderers;
using Markdig.Syntax;
@@ -23,7 +24,7 @@ public sealed class MarkdownConverter : IConverter
// Cheaper than Pandoc's Markdown edges, so the built-in path wins for HTML and TXT.
public IReadOnlyList<ConversionEdge> Edges { get; } = [new("md", "html", 4), new("md", "txt", 5)];
- public EngineStatus GetStatus() => EngineStatus.Available("Markdig");
+ public EngineStatus GetStatus() => EngineStatus.Available(version: EngineVersions.Library("Markdig", typeof(Markdown)));
public async Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken)
{
diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.cs
index 6810f317..a471c1dd 100644
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@ -37,6 +37,36 @@ public class RenderTests
window.Close();
}
+ [AvaloniaFact]
+ public void Engines_page_shows_versions_descriptions_and_download_speed()
+ {
+ TestServices.EnsureInitialized("ko");
+ var downloads = AppHost.Get<EngineDownloadService>();
+ var package = downloads.Packages[0];
+ var before = (package.Status, package.Progress, package.ProgressDetail);
+ package.Status = EnginePackageStatus.Downloading;
+ package.Progress = 42;
+ package.ProgressDetail = "176 MB / 422 MB · 8.4 MB/s · 30초 남음";
+ try
+ {
+ var vm = new MainWindowViewModel(AppHost.Services, AppHost.Get<Filee.Core.Localization.ILocalizer>(), AppHost.Get<UpdateService>());
+ vm.Navigate("engines");
+ var window = new MainWindow { DataContext = vm, Width = 1080, Height = 1400 };
+ window.Show();
+ Pump();
+
+ var engines = ((Filee.App.ViewModels.Pages.EnginesPageViewModel)vm.CurrentPage).Engines;
+ Assert.All(engines.Where(e => e.IsAvailable), e => Assert.False(string.IsNullOrWhiteSpace(e.Version)));
+ Assert.All(engines, e => Assert.False(string.IsNullOrWhiteSpace(e.Description)));
+ Save(window, "page-engines-downloading-ko.png");
+ window.Close();
+ }
+ finally
+ {
+ (package.Status, package.Progress, package.ProgressDetail) = before;
+ }
+ }
+
[AvaloniaFact]
public void Donut_toolbar_renders_for_images()
{
diff --git a/tests/Filee.Engines.Tests/EngineInstallerTests.cs b/tests/Filee.Engines.Tests/EngineInstallerTests.cs
index be0133de..8cd00c3d 100644
--- a/tests/Filee.Engines.Tests/EngineInstallerTests.cs
+++ b/tests/Filee.Engines.Tests/EngineInstallerTests.cs
@@ -73,6 +73,9 @@ public sealed class EngineInstallerTests : IDisposable
Assert.True(installer.IsUpToDate(package));
Assert.Contains(reports, r => r.Stage == EngineInstallStage.Unpacking);
Assert.Equal(1.0, reports.Where(r => r.Stage == EngineInstallStage.Downloading).Max(r => r.Fraction), 3);
+ // Byte counts drive the speed and time-left display.
+ var last = reports.Last(r => r.Stage == EngineInstallStage.Downloading);
+ Assert.Equal((archive.Length, archive.Length), ((int)last.BytesDone, (int)last.BytesTotal));
// Nothing is left over from downloading or unpacking.
Assert.Equal(["tool"], Directory.GetDirectories(_root).Select(Path.GetFileName).Where(n => !n!.StartsWith(".downloads", StringComparison.Ordinal)));
Assert.Empty(Directory.GetFiles(Path.Combine(_root, ".downloads")));
@@ -85,6 +88,27 @@ public sealed class EngineInstallerTests : IDisposable
Assert.False(Directory.Exists(Path.Combine(_root, "tool")));
}
+ [Fact]
+ public void Transfer_rate_averages_over_the_last_seconds_and_estimates_the_time_left()
+ {
+ var rate = new TransferRate(TimeSpan.FromSeconds(5));
+ Assert.Null(rate.Remaining(0, 1000));
+
+ rate.Add(TimeSpan.Zero, 0);
+ rate.Add(TimeSpan.FromSeconds(0.2), 100); // too short to tell
+ Assert.Equal(0, rate.BytesPerSecond);
+
+ for (var second = 1; second <= 10; second++)
+ rate.Add(TimeSpan.FromSeconds(second), second * 1_000_000L);
+ Assert.Equal(1_000_000, rate.BytesPerSecond, 0);
+ Assert.Equal(TimeSpan.FromSeconds(30), rate.Remaining(10_000_000, 40_000_000));
+
+ // The speed follows a slower connection within the window instead of keeping the old average.
+ for (var second = 11; second <= 20; second++)
+ rate.Add(TimeSpan.FromSeconds(second), 10_000_000L + (second - 10) * 100_000L);
+ Assert.Equal(100_000, rate.BytesPerSecond, 0);
+ }
+
[Fact]
public async Task A_download_with_the_wrong_checksum_is_rejected_and_nothing_is_installed()
{