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.

Merge origin/main: document formats, codecs and subtitles, more image formats, data and e-mail (3D models settings migration is now schema 15; 244 formats)

KnifeLemon282b273f0d93
diff --cc Directory.Packages.props
index 39f9b73a,b9e69b7b..d0901cef
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@@ -47,7 -47,11 +47,12 @@@
<PackageVersion Include="MimeKitLite" Version="4.18.1" />
<PackageVersion Include="ACadSharp" Version="3.8.0" />
<PackageVersion Include="AngleSharp" Version="1.8.2" />
+ <PackageVersion Include="YamlDotNet" Version="18.1.0" />
+ <PackageVersion Include="Tomlyn" Version="2.10.1" />
+ <!-- 6.2 no longer reads files an attachment only links to (ATTACH_BY_REFERENCE) and caps nested messages and
+ stream sizes of untrusted .msg files; brings OpenMcdf (MPL-2.0), RtfPipe and UTF.Unknown (MPL-1.1). -->
+ <PackageVersion Include="MsgReader" Version="6.2.0" />
+ <PackageVersion Include="SharpGLTF.Core" Version="1.0.7" />
</ItemGroup>
<ItemGroup Label="Tests">
diff --cc README.ko.md
index 233171f2,bb2e8b49..c8a4d21c
--- a/README.ko.md
+++ b/README.ko.md
@@@ -29,7 -29,7 +29,7 @@@
<table>
<tr>
<td width="33%" valign="top"><b>커서 바로 옆에서</b><br>앱 창을 열 필요가 없어요. 끌고 있는 파일에 맞는 형식만 지금 있는 자리에 나타나요.</td>
- <td width="33%" valign="top"><b>180가지 형식, 다른 프로그램 없이</b><br>이미지, PDF, 워드, 엑셀, 파워포인트, HWP, 전자책, 압축 파일, 글꼴, CAD, 3D 모델을 오피스·한컴오피스·LibreOffice 없이 변환해요.</td>
- <td width="33%" valign="top"><b>238가지 형식, 다른 프로그램 없이</b><br>이미지, PDF, 워드, 엑셀, 파워포인트, HWP, 전자책, 압축 파일, 글꼴, CAD를 오피스·한컴오피스·LibreOffice 없이 변환해요.</td>
++ <td width="33%" valign="top"><b>244가지 형식, 다른 프로그램 없이</b><br>이미지, PDF, 워드, 엑셀, 파워포인트, HWP, 전자책, 압축 파일, 글꼴, CAD, 3D 모델을 오피스·한컴오피스·LibreOffice 없이 변환해요.</td>
<td width="33%" valign="top"><b>내 컴퓨터 안에서만</b><br>아무것도 업로드하지 않아요. 오프라인으로 동작하고 결과는 원본 옆에 저장해요.</td>
</tr>
</table>
@@@ -95,7 -96,8 +96,8 @@@
| **압축 파일**: ZIP, 7Z, RAR, TAR, TAR.GZ, TAR.BZ2, TAR.XZ, GZ, ISO, CAB, DMG, ALZ, EGG 등 | 압축 풀기, ZIP, 7Z, TAR, TAR.GZ; 여러 파일 → ZIP 하나 |
| **CAD**: DWG, DXF | PDF, SVG, PNG, DWG ↔ DXF |
| **글꼴**: TTF, OTF, WOFF, WOFF2, EOT | 서로 변환 |
+ | **데이터**: JSON, JSON Lines, YAML, TOML, XML · vCard | 서로 변환, CSV·XLSX(표 모양 데이터); vCard ↔ CSV |
-| **데이터**: JSON, JSON Lines, YAML, TOML, XML · vCard | 서로 변환, CSV·XLSX(표 모양 데이터); vCard ↔ CSV |
+| **3D 모델**: GLB, glTF, STL, OBJ (+ MTL), 3MF, PLY | 서로 변환, PNG 미리보기 |
표시가 없는 형식은 오피스·한컴오피스·LibreOffice 없이 바로 변환돼요.
표시가 있는 형식은 추가 엔진이 필요하고, 필요할 때만 내려받아요: ¹ Ghostscript, ² LibreOffice, ³ Pandoc,
diff --cc README.md
index ec6611ac,cf1fec9f..07de1952
--- a/README.md
+++ b/README.md
@@@ -29,7 -29,7 +29,7 @@@
<table>
<tr>
<td width="33%" valign="top"><b>Right at your cursor</b><br>No app window to open. The formats appear where you already are, only the ones that make sense for the files you drag.</td>
- <td width="33%" valign="top"><b>180 formats, no other software</b><br>Images, PDF, Word, Excel, PowerPoint, HWP, e-books, archives, fonts, CAD and 3D models work without Office, Hancom Office or LibreOffice.</td>
- <td width="33%" valign="top"><b>238 formats, no other software</b><br>Images, PDF, Word, Excel, PowerPoint, HWP, e-books, archives, fonts and CAD work without Office, Hancom Office or LibreOffice.</td>
++ <td width="33%" valign="top"><b>244 formats, no other software</b><br>Images, PDF, Word, Excel, PowerPoint, HWP, e-books, archives, fonts, CAD and 3D models work without Office, Hancom Office or LibreOffice.</td>
<td width="33%" valign="top"><b>Stays on your computer</b><br>Nothing is uploaded. Filee works offline and saves the result next to the original.</td>
</tr>
</table>
@@@ -95,7 -96,8 +96,8 @@@ Filee shows new releases in its menu an
| **Archives**: ZIP, 7Z, RAR, TAR, TAR.GZ, TAR.BZ2, TAR.XZ, GZ, ISO, CAB, DMG, ALZ, EGG, … | extract, ZIP, 7Z, TAR, TAR.GZ; any files → one ZIP |
| **CAD**: DWG, DXF | PDF, SVG, PNG, DWG ↔ DXF |
| **Fonts**: TTF, OTF, WOFF, WOFF2, EOT | each other |
+ | **Data**: JSON, JSON Lines, YAML, TOML, XML · vCard | each other, CSV and XLSX (tables); vCard ↔ CSV |
-| **Data**: JSON, JSON Lines, YAML, TOML, XML · vCard | each other, CSV and XLSX (tables); vCard ↔ CSV |
+| **3D models**: GLB, glTF, STL, OBJ (+ MTL), 3MF, PLY | each other, PNG preview |
Unmarked formats work out of the box, without Office, Hancom Office or LibreOffice.
Marked ones need an optional engine, downloaded only when needed: ¹ Ghostscript, ² LibreOffice, ³ Pandoc, ⁴ calibre,
diff --cc README.zh-CN.md
index a64a1e94,c1cf92b8..efd2e96e
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@@ -29,7 -29,7 +29,7 @@@
<table>
<tr>
<td width="33%" valign="top"><b>就在光标旁</b><br>无需打开应用窗口。只显示适合当前拖动文件的格式,就在你所在的位置。</td>
- <td width="33%" valign="top"><b>180 种格式,无需其他软件</b><br>图片、PDF、Word、Excel、PowerPoint、HWP、电子书、压缩包、字体、CAD 和 3D 模型,无需 Office、韩文办公软件或 LibreOffice。</td>
- <td width="33%" valign="top"><b>238 种格式,无需其他软件</b><br>图片、PDF、Word、Excel、PowerPoint、HWP、电子书、压缩包、字体和 CAD,无需 Office、韩文办公软件或 LibreOffice。</td>
++ <td width="33%" valign="top"><b>244 种格式,无需其他软件</b><br>图片、PDF、Word、Excel、PowerPoint、HWP、电子书、压缩包、字体、CAD 和 3D 模型,无需 Office、韩文办公软件或 LibreOffice。</td>
<td width="33%" valign="top"><b>只在你的电脑上</b><br>不上传任何文件。Filee 离线工作,结果保存在原文件旁边。</td>
</tr>
</table>
@@@ -94,7 -95,8 +95,8 @@@
| **压缩包**:ZIP、7Z、RAR、TAR、TAR.GZ、TAR.BZ2、TAR.XZ、GZ、ISO、CAB、DMG、ALZ、EGG 等 | 解压、ZIP、7Z、TAR、TAR.GZ;多个文件 → 一个 ZIP |
| **CAD**:DWG、DXF | PDF、SVG、PNG、DWG ↔ DXF |
| **字体**:TTF、OTF、WOFF、WOFF2、EOT | 互相转换 |
+ | **数据**:JSON、JSON Lines、YAML、TOML、XML · vCard | 互相转换、CSV 和 XLSX(表格数据)、vCard ↔ CSV |
-| **数据**:JSON、JSON Lines、YAML、TOML、XML · vCard | 互相转换、CSV 和 XLSX(表格数据)、vCard ↔ CSV |
+| **3D 模型**:GLB、glTF、STL、OBJ(+ MTL)、3MF、PLY | 互相转换、PNG 预览 |
未标注的格式装好即用,无需 Office、韩文办公软件或 LibreOffice。
标注的格式需要可选引擎,只在需要时下载,分别是 ¹ Ghostscript、² LibreOffice、³ Pandoc、⁴ calibre、⁵ FFmpeg
diff --cc THIRD-PARTY-NOTICES.md
index b3446e00,74ae2144..4e47f4d6
--- a/THIRD-PARTY-NOTICES.md
+++ b/THIRD-PARTY-NOTICES.md
@@@ -25,8 -25,14 +25,15 @@@ Each component remains under its own li
| ExcelDataReader | MIT | https://github.com/ExcelDataReader/ExcelDataReader |
| PdfPig (PDF text, layout and pictures) | Apache-2.0 | https://github.com/UglyToad/PdfPig |
| MimeKitLite (e-mail / MIME parsing) | MIT | https://github.com/jstedfast/MimeKit |
+ | MsgReader (Outlook .msg reading) | MIT, Copyright (c) Kees van Spelde | https://github.com/Sicos1977/MSGReader |
+ | OpenMcdf (OLE compound files, used by MsgReader) | MPL-2.0 (source: the project page) | https://github.com/openmcdf/openmcdf |
+ | RtfPipe (RTF → HTML, used by MsgReader) | MIT, Copyright (c) 2018 Eric Domke | https://github.com/erdomke/RtfPipe |
+ | UTF.Unknown (charset detection, used by MsgReader) | MPL-1.1 (source: the project page) | https://github.com/CharsetDetector/UTF-unknown |
+ | Microsoft.Maui.Graphics, Microsoft.IO.RecyclableMemoryStream (used by MsgReader) | MIT | https://github.com/dotnet/maui, https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream |
+ | YamlDotNet (YAML reading and writing) | MIT, Copyright (c) Antoine Aubry and contributors | https://github.com/aaubry/YamlDotNet |
+ | Tomlyn (TOML reading) | BSD-2-Clause, Copyright (c) Alexandre Mutel | https://github.com/xoofx/Tomlyn |
| ACadSharp (DWG/DXF reading and writing; includes CSMath and CSUtilities) | MIT, Copyright (c) Albert Domenech | https://github.com/DomCR/ACadSharp |
+| SharpGLTF.Core (glTF / GLB reading and writing) | MIT, Copyright (c) Vicente Penades | https://github.com/vpenades/SharpGLTF |
| AngleSharp | MIT | https://github.com/AngleSharp/AngleSharp |
| pypandoc-hwpx (Pandoc AST mapping and package layout in `Filee.Engines/Hwp/Hwpx`, incl. the `blank.hwpx` reference document) | MIT, Copyright (c) 2024 pypandoc-hwpx Contributors | https://github.com/msjang/pypandoc-hwpx |
| Microsoft.Extensions.* | MIT | https://github.com/dotnet/runtime |
diff --cc docs/ARCHITECTURE.md
index cb6dc95f,c8631cc1..9965fd3d
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@@ -22,7 -22,7 +22,7 @@@
│ Built in: Magick (images, RAW) · PdfSharp · Pdfium · PdfPig · Svg.Skia · ICNS │
│ HwpxWriter + DocxWriter over DocumentReaders (DOCX, XLSX, XLS, ODS, PPTX, │
│ PDF, HTML, EPUB, MOBI, FB2, HWPX, Markdown) · Spreadsheets · OOXML variants │
- │ · E-mail · E-books · CAD · Fonts · 3D models │
- │ · E-mail · Data · E-books · CAD · Fonts · Subtitles │
++ │ · E-mail · Data · E-books · CAD · Fonts · Subtitles · 3D models │
│ Bundled: rhwp (HWP→PDF, HWP↔HWPX) · 7-Zip (archives) · Unhwp · Markdig │
│ Optional: FFmpeg · LibreOffice + H2Orestart · calibre · Ghostscript · Pandoc │
└────────────────────────────────────────────────────────────────────────────────────┘
diff --cc docs/ENGINES.md
index 6ee27922,91b63768..0fd7f2a0
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@@ -18,16 -18,17 +18,18 @@@ Filee chooses engines automatically. Se
| **HWPX writer** | built in | **DOCX (+ DOCM/DOTX/DOTM), XLSX (+ XLSM/XLTX), XLS, ODS, CSV, TSV, PPTX (+ PPTM/POTX/PPSX), PDF, HTML, EPUB, MOBI/AZW3, FB2, HWPX, TXT, Markdown → HWPX** (and with rhwp → PDF and images); ODT, RTF, reStructuredText, LaTeX → HWPX with Pandoc |
| **DOCX writer** | built in | **HWPX (and HWP through rhwp), PDF, HTML, EPUB, MOBI/AZW3, FB2, Markdown, TXT, XLSX, XLS, ODS, CSV, PPTX (+ variants) → DOCX** |
| PDF text | built in (PdfPig) | **PDF → TXT** (reading order, also two columns; no OCR) |
- | E-mail | built in (MimeKit) | **EML → HTML** (headers + body, inline pictures), **TXT**, **ZIP** (the attachments) |
- | **E-books** | built in | **EPUB, MOBI/AZW/AZW3/PRC, FB2, HTMLZ, TXTZ → EPUB, HWPX (→ PDF), TXT, HTML, Markdown, FB2, HTMLZ, TXTZ**; HTML, Markdown, TXT, DOCX → EPUB/FB2/HTMLZ/TXTZ; HTML → TXT; comics CBZ/CBR/CB7/CBT/CBC → PDF, EPUB, CBZ; PDF → CBZ; AZW4 → PDF |
+ | E-mail | built in (MimeKit, MsgReader) | **EML, Outlook MSG → HTML** (headers + body, inline pictures), **TXT**, **ZIP** (the attachments); **MSG → EML** |
+ | Data | built in (System.Text.Json, YamlDotNet, Tomlyn, System.Xml) | **JSON, JSON Lines, YAML, TOML, XML, CSV ↔ each other** (CSV for tables); **vCard ↔ CSV**; spreadsheets and contacts reach JSON / YAML / TOML / XML through CSV |
+ | **E-books** | built in | **EPUB, MOBI/AZW/AZW3/PRC, FB2, HTMLZ, TXTZ → EPUB, HWPX (→ PDF), TXT, HTML, Markdown, FB2, HTMLZ, TXTZ**; HTML, Markdown, TXT, DOCX → EPUB/FB2/HTMLZ/TXTZ; HTML → TXT; comics CBZ/CBR/CB7/CBT/CBC → PDF, EPUB, CBZ; PDF → CBZ; AZW4 → PDF; **EPUB ↔ KEPUB** (Kobo) |
| CAD (ACadSharp + built-in renderer) | built in (library) | **DWG ↔ DXF**; DWG/DXF → **PDF** (vector), **SVG**, PNG, JPG, WEBP, TIFF, BMP, GIF, ICO, AVIF |
+ | **Subtitles** | built in | **SRT, ASS/SSA, WebVTT, SAMI (SMI), LRC, TTML, MicroDVD, SCC → SRT, ASS, WebVTT, SAMI, LRC, TTML, MicroDVD**, always UTF-8 (Korean CP949 / EUC-KR files read correctly) |
+| 3D models (SharpGLTF for glTF) | built in (library) | **GLB, glTF, STL, OBJ (+ MTL), 3MF, PLY ↔ each other**; → PNG, JPG, … (an isometric preview) |
| rhwp | bundled with the installer (`engines/rhwp`) | HWP/HWPX → PDF, **HWP → HWPX, HWPX → HWP** |
| Archives (7-Zip) | bundled with the installer (`engines/7zip`, ~2.5 MB) + built-in readers | ZIP, 7Z, RAR, TAR (+ GZ/BZ2/XZ/Z/7Z/LZ), CAB, ISO, DMG, … **→ folder, ZIP, 7Z, TAR, TAR.GZ/BZ2/XZ**; ALZ, EGG, lzip read in-process; "Compress into one archive" for any files |
- | LibreOffice + H2Orestart + Java | **optional download** (~420 MB, 1.3 GB on disk) | older and rare formats only: DOC, XLS, PPT, RTF and OpenDocument → PDF and to each other, output as DOCX/ODT/ODS/ODP; HWP/HWPX → DOCX/ODT; read-only formats (see below) → PDF and their kind's editable formats |
- | Pandoc | **optional download** (~42 MB, 240 MB on disk) | Markdown ↔ DOCX/ODT/RTF, DOCX/ODT/HTML/RTF → Markdown, HTML ↔ DOCX/ODT, reStructuredText and LaTeX ↔ Markdown/HTML/DOCX/ODT (and → RTF, EPUB, TXT) |
+ | LibreOffice + H2Orestart + Java | **optional download** (~420 MB, 1.3 GB on disk) | older and rare formats only: DOC, XLS, PPT, RTF and OpenDocument → PDF and to each other, output as DOCX/ODT/ODS/ODP; HWP/HWPX → DOCX/ODT; read-only formats (see below) → PDF and their kind's editable formats; FODT, OpenDocument templates (OTT, OTS, OTP) and XLT out; SVG → EMF/WMF/ODG, a PDF page → SVG |
+ | Pandoc | **optional download** (~42 MB, 240 MB on disk) | Markdown ↔ DOCX/ODT/RTF, DOCX/ODT/HTML/RTF → Markdown, HTML ↔ DOCX/ODT, markup languages (reStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter, Textile, man, OPML) ↔ Markdown/HTML/DOCX/ODT and each other (and → RTF, EPUB, TXT), Markdown and markup → PPTX slides |
| Ghostscript | **optional download** (~20 MB, 31 MB on disk) | EPS/PS → PDF, PDF → EPS/PS, PostScript-based AI → PDF (images through PDF and PDFium) |
- | FFmpeg | **optional download** (~100 MB, 272 MB on disk) | **all video and audio**: video ↔ video, video → animated GIF or a still frame, audio extraction, audio ↔ audio, GIF and photos → MP4/WEBM/MOV, images → HEIC |
+ | FFmpeg | **optional download** (~100 MB, 272 MB on disk) | **all video and audio**: video ↔ video (H.264, HEVC, AV1), video → animated GIF / APNG or a still frame, audio and subtitle extraction, audio ↔ audio (also APE, WavPack, TTA, DSD, DTS, ALAC, …), GIF, APNG and photos → MP4/WEBM/MOV, images → HEIC |
| Calibre | **optional download** (~216 MB, 660 MB on disk) | rare e-book formats: LIT, LRF, CHM, PDB, PML, RB, SNB, TCR, OEB → EPUB; EPUB → MOBI, AZW3, LIT, LRF, PDB, PML, RB, SNB, TCR |
DOCX, XLSX, XLS, ODS and PPTX → PDF need neither Microsoft Office nor LibreOffice: they are read in-process, written as HWPX
diff --cc src/Filee.App/Assets/i18n/en.json
index 35454c30,e84bf075..0b0f1f07
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@@ -76,14 -77,14 +77,15 @@@
"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.model3d.description": "3D models: GLB, glTF, STL, OBJ, 3MF and PLY into each other, and a PNG preview.",
"engine.archive.description": "Extracts ZIP, 7Z, RAR, TAR, ISO and more, and packs ZIP, 7Z or TAR.GZ (7-Zip).",
- "engine.ebook.description": "EPUB, MOBI, AZW3, FB2 and comics (CBZ, CBR) to PDF, EPUB, DOCX and text.\nAlso documents to EPUB and PDF to CBZ.",
- "engine.ffmpeg.description": "Video and audio: MP4, MOV, MKV, WEBM, MP3, M4A, WAV, FLAC and more.\nAlso extracts sound, makes GIFs and saves images as HEIC.",
- "engine.pandoc.description": "Markdown and HTML ↔ ODT and RTF, DOCX → Markdown\nreStructuredText and LaTeX ↔ Markdown, HTML, DOCX and ODT",
+ "engine.ebook.description": "EPUB, MOBI, AZW3, FB2 and comics (CBZ, CBR) to PDF, EPUB, DOCX and text.\nAlso documents to EPUB, EPUB to KEPUB for Kobo and PDF to CBZ.",
+ "engine.subtitle.description": "Subtitles: SRT, ASS/SSA, WebVTT, SAMI (SMI), LRC, TTML, MicroDVD and SCC into each other, saved as UTF-8.\nKorean SMI and SRT files in CP949 / EUC-KR read correctly.",
+ "engine.ffmpeg.description": "Video and audio: MP4, MOV, MKV, WEBM, MP3, M4A, WAV, FLAC and more.\nAlso extracts sound and subtitles, makes GIF and APNG animations and saves images as HEIC.",
+ "engine.pandoc.description": "Markdown and HTML ↔ ODT and RTF, DOCX → Markdown\nreStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter and more ↔ Markdown, HTML, DOCX and ODT\nMarkdown and Org → PPTX slides",
"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": "Reads older and less common formats: DOC, PPT, Pages, Keynote, Numbers, WordPerfect, Publisher, Visio…\nAlso saves as DOC, XLS, PPT, ODT or ODP.",
+ "engine.libreoffice.description": "Reads older and less common formats: DOC, PPT, Pages, Keynote, Numbers, WordPerfect, ClarisWorks, Publisher, Visio…\nAlso saves as DOC, XLS, PPT, ODT, ODP, OpenDocument templates and EMF.",
"profile.images": "Images",
"profile.pdf": "PDF",
@@@ -99,7 -101,7 +102,8 @@@
"profile.archives": "Archives",
"profile.cad": "CAD drawings",
"profile.fonts": "Fonts",
+ "profile.data": "Data",
+ "profile.models": "3D models",
"profile.mixed": "Mixed files",
"preset.half_size": "Half size",
@@@ -126,7 -129,8 +131,9 @@@
"format.category.Vector": "Vector",
"format.category.Cad": "CAD",
"format.category.Font": "Font",
+ "format.category.Subtitle": "Subtitle",
+ "format.category.Data": "Data",
+ "format.category.Model3D": "3D model",
"general.title": "General",
"general.language": "Language",
diff --cc src/Filee.App/Assets/i18n/ko.json
index f6010cd6,b1ebc759..fce89b71
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@@ -76,14 -77,14 +77,15 @@@
"engine.icns.description": "macOS 앱 아이콘(ICNS)을 이미지로, 이미지를 ICNS로.",
"engine.font.description": "글꼴: TTF, OTF, WOFF, WOFF2, EOT를 서로 변환해요.",
"engine.cad.description": "오토캐드 도면: DWG ↔ DXF, 그리고 둘 다 PDF, SVG, PNG로.",
+ "engine.model3d.description": "3D 모델: GLB, glTF, STL, OBJ, 3MF, PLY를 서로 변환하고 PNG 미리보기도 만들어요.",
"engine.archive.description": "ZIP, 7Z, RAR, TAR, ISO 등을 풀고, ZIP·7Z·TAR.GZ로 묶어요(7-Zip).",
- "engine.ebook.description": "EPUB, MOBI, AZW3, FB2, 만화책(CBZ, CBR)을 PDF, EPUB, DOCX, 텍스트로 바꿔요.\n문서는 EPUB으로, PDF는 CBZ로도 만들어요.",
- "engine.ffmpeg.description": "MP4, MOV, MKV, WEBM, MP3, M4A, WAV, FLAC 등 동영상·오디오를 변환해요.\n소리 추출, GIF 만들기, 이미지 → HEIC도 해요.",
- "engine.pandoc.description": "마크다운·HTML ↔ ODT·RTF, DOCX → 마크다운\nreStructuredText·LaTeX ↔ 마크다운·HTML·DOCX·ODT",
+ "engine.ebook.description": "EPUB, MOBI, AZW3, FB2, 만화책(CBZ, CBR)을 PDF, EPUB, DOCX, 텍스트로 바꿔요.\n문서는 EPUB으로, EPUB은 코보용 KEPUB으로, PDF는 CBZ로도 만들어요.",
+ "engine.subtitle.description": "SRT, ASS/SSA, WebVTT, SAMI(SMI), LRC, TTML, MicroDVD, SCC 자막을 서로 바꾸고 UTF-8로 저장해요.\nCP949/EUC-KR로 된 SMI·SRT 파일도 한글이 깨지지 않아요.",
+ "engine.ffmpeg.description": "MP4, MOV, MKV, WEBM, MP3, M4A, WAV, FLAC 등 동영상·오디오를 변환해요.\n소리·자막 추출, GIF·APNG 만들기, 이미지 → HEIC도 해요.",
+ "engine.pandoc.description": "마크다운·HTML ↔ ODT·RTF, DOCX → 마크다운\nreStructuredText·LaTeX·Org·AsciiDoc·Typst·MediaWiki·DocBook·Jupyter 등 ↔ 마크다운·HTML·DOCX·ODT\n마크다운·Org → PPTX 슬라이드",
"engine.ghostscript.description": "EPS, 포스트스크립트, 예전 일러스트레이터 파일을 PDF와 이미지로, PDF를 EPS·PS로.",
"engine.calibre.description": "드문 전자책 형식(LIT, LRF, CHM, PDB, RB…)과 킨들용 출력(MOBI, AZW3).",
- "engine.libreoffice.description": "DOC, PPT, Pages, Keynote, Numbers, 워드퍼펙트, Publisher, Visio 같은 오래되었거나 드문 형식을 읽어요.\nDOC·XLS·PPT·ODT·ODP로 저장도 해요.",
+ "engine.libreoffice.description": "DOC, PPT, Pages, Keynote, Numbers, 워드퍼펙트, ClarisWorks, Publisher, Visio 같은 오래되었거나 드문 형식을 읽어요.\nDOC·XLS·PPT·ODT·ODP, 오픈도큐먼트 서식 파일, EMF로 저장도 해요.",
"profile.images": "이미지",
"profile.pdf": "PDF",
@@@ -99,7 -101,7 +102,8 @@@
"profile.archives": "압축 파일",
"profile.cad": "CAD 도면",
"profile.fonts": "글꼴",
+ "profile.data": "데이터",
+ "profile.models": "3D 모델",
"profile.mixed": "혼합 파일",
"preset.half_size": "50% 축소",
@@@ -126,7 -129,8 +131,9 @@@
"format.category.Vector": "벡터",
"format.category.Cad": "CAD",
"format.category.Font": "글꼴",
+ "format.category.Subtitle": "자막",
+ "format.category.Data": "데이터",
+ "format.category.Model3D": "3D 모델",
"general.title": "일반",
"general.language": "언어",
diff --cc src/Filee.App/Assets/i18n/zh-CN.json
index 4fa7f47f,21d243a6..e0ad99db
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@@ -76,14 -77,14 +77,15 @@@
"engine.icns.description": "macOS 应用图标(ICNS)与图片互转。",
"engine.font.description": "字体:TTF、OTF、WOFF、WOFF2 和 EOT 互相转换。",
"engine.cad.description": "AutoCAD 图纸:DWG ↔ DXF,并可转为 PDF、SVG 和 PNG。",
+ "engine.model3d.description": "GLB、glTF、STL、OBJ、3MF 和 PLY 3D 模型互相转换,并可生成 PNG 预览。",
"engine.archive.description": "解压 ZIP、7Z、RAR、TAR、ISO 等,并打包为 ZIP、7Z 或 TAR.GZ(7-Zip)。",
- "engine.ebook.description": "EPUB、MOBI、AZW3、FB2 和漫画(CBZ、CBR)转为 PDF、EPUB、DOCX 和文本。\n也能把文档转为 EPUB、把 PDF 转为 CBZ。",
- "engine.ffmpeg.description": "MP4、MOV、MKV、WEBM、MP3、M4A、WAV、FLAC 等视频和音频。\n还能提取声音、制作 GIF、把图片保存为 HEIC。",
- "engine.pandoc.description": "Markdown 和 HTML ↔ ODT、RTF,DOCX → Markdown\nreStructuredText、LaTeX ↔ Markdown、HTML、DOCX、ODT",
+ "engine.ebook.description": "EPUB、MOBI、AZW3、FB2 和漫画(CBZ、CBR)转为 PDF、EPUB、DOCX 和文本。\n也能把文档转为 EPUB、把 EPUB 转为 Kobo 用的 KEPUB、把 PDF 转为 CBZ。",
+ "engine.subtitle.description": "SRT、ASS/SSA、WebVTT、SAMI(SMI)、LRC、TTML、MicroDVD、SCC 字幕互转,保存为 UTF-8。\n也能正确读取 CP949/EUC-KR 编码的韩文字幕。",
+ "engine.ffmpeg.description": "MP4、MOV、MKV、WEBM、MP3、M4A、WAV、FLAC 等视频和音频。\n还能提取声音和字幕、制作 GIF 和 APNG、把图片保存为 HEIC。",
+ "engine.pandoc.description": "Markdown 和 HTML ↔ ODT、RTF,DOCX → Markdown\nreStructuredText、LaTeX、Org、AsciiDoc、Typst、MediaWiki、DocBook、Jupyter 等 ↔ Markdown、HTML、DOCX、ODT\nMarkdown 和 Org → PPTX 幻灯片",
"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、PPT、Pages、Keynote、Numbers、WordPerfect、Publisher、Visio。\n也能保存为 DOC、XLS、PPT、ODT 或 ODP。",
+ "engine.libreoffice.description": "读取较旧或少见的格式,如 DOC、PPT、Pages、Keynote、Numbers、WordPerfect、ClarisWorks、Publisher、Visio。\n也能保存为 DOC、XLS、PPT、ODT、ODP、OpenDocument 模板或 EMF。",
"profile.images": "图片",
"profile.pdf": "PDF",
@@@ -99,7 -101,7 +102,8 @@@
"profile.archives": "压缩文件",
"profile.cad": "CAD 图纸",
"profile.fonts": "字体",
+ "profile.data": "数据",
+ "profile.models": "3D 模型",
"profile.mixed": "混合文件",
"preset.half_size": "缩小 50%",
@@@ -126,7 -129,8 +131,9 @@@
"format.category.Vector": "矢量图",
"format.category.Cad": "CAD",
"format.category.Font": "字体",
+ "format.category.Subtitle": "字幕",
+ "format.category.Data": "数据",
+ "format.category.Model3D": "3D 模型",
"general.title": "常规",
"general.language": "语言",
diff --cc src/Filee.App/ViewModels/PresetEditorViewModel.cs
index b41f4509,83b089b1..ff9a2edd
--- a/src/Filee.App/ViewModels/PresetEditorViewModel.cs
+++ b/src/Filee.App/ViewModels/PresetEditorViewModel.cs
@@@ -232,8 -282,9 +282,9 @@@ public sealed partial class PresetEdito
public bool ShowWebp => TargetId is "webp" or BuiltInData.SameAsSource;
public bool ShowMultiPageTiff => TargetId is "tiff";
public bool ShowIco => TargetId == "ico";
- /// <summary>PDF options (also used when a PDF source becomes images) mean nothing for media, archive and font targets.</summary>
- public bool ShowPdf => TargetCategory is not (FormatCategory.Video or FormatCategory.Audio or FormatCategory.Archive or FormatCategory.Font or FormatCategory.Model3D);
- /// <summary>PDF options (also used when a PDF source becomes images) mean nothing for media, archive, font, subtitle, data and e-mail targets.</summary>
++ /// <summary>PDF options (also used when a PDF source becomes images) mean nothing for media, archive, font, subtitle, data, e-mail and 3D targets.</summary>
+ public bool ShowPdf => TargetCategory is not (FormatCategory.Video or FormatCategory.Audio or FormatCategory.Archive or FormatCategory.Font
- or FormatCategory.Subtitle or FormatCategory.Data) && TargetId != "eml";
++ or FormatCategory.Subtitle or FormatCategory.Data or FormatCategory.Model3D) && TargetId != "eml";
public bool ShowPdfBuild => TargetId == "pdf";
public bool ShowPdfSplit => TargetId == "pdf";
diff --cc src/Filee.Core/Formats/FileFormat.cs
index 40a945f3,f9d7a524..eca34e16
--- a/src/Filee.Core/Formats/FileFormat.cs
+++ b/src/Filee.Core/Formats/FileFormat.cs
@@@ -19,7 -19,8 +19,9 @@@ public enum FormatCategor
Vector,
Cad,
Font,
+ Subtitle,
+ Data,
+ Model3D,
}
/// <summary>
diff --cc src/Filee.Core/Formats/FormatRegistry.cs
index 09542546,0aef5519..de25f16c
--- a/src/Filee.Core/Formats/FormatRegistry.cs
+++ b/src/Filee.Core/Formats/FormatRegistry.cs
@@@ -214,13 -278,16 +278,24 @@@ public static class FormatRegistr
new("woff2", "WOFF2", FormatCategory.Font, ["woff2"]),
new("eot", "EOT", FormatCategory.Font, ["eot"]),
+ // Subtitles (text)
+ new("srt", "SRT", FormatCategory.Subtitle, ["srt"]),
+ new("ass", "ASS", FormatCategory.Subtitle, ["ass"]),
+ new("ssa", "SSA", FormatCategory.Subtitle, ["ssa"], Writable: false),
+ new("vtt", "WebVTT", FormatCategory.Subtitle, ["vtt"]),
+ new("smi", "SAMI", FormatCategory.Subtitle, ["smi", "sami"]),
+ new("lrc", "LRC", FormatCategory.Subtitle, ["lrc"]),
+ new("ttml", "TTML", FormatCategory.Subtitle, ["ttml", "dfxp"]),
+ new("sub", "MicroDVD", FormatCategory.Subtitle, ["sub"]),
+ new("scc", "SCC", FormatCategory.Subtitle, ["scc"], Writable: false),
++
+ // 3D models
+ new("glb", "GLB", FormatCategory.Model3D, ["glb"]),
+ new("gltf", "glTF", FormatCategory.Model3D, ["gltf"]),
+ new("stl", "STL", FormatCategory.Model3D, ["stl"]),
+ new("obj", "OBJ", FormatCategory.Model3D, ["obj"]),
+ new("3mf", "3MF", FormatCategory.Model3D, ["3mf"]),
+ new("ply", "PLY", FormatCategory.Model3D, ["ply"]),
];
private static readonly Dictionary<string, FileFormat> ById =
diff --cc src/Filee.Core/Presets/BuiltInData.cs
index 57ee5d96,c0572742..404f9433
--- a/src/Filee.Core/Presets/BuiltInData.cs
+++ b/src/Filee.Core/Presets/BuiltInData.cs
@@@ -74,9 -74,38 +74,39 @@@ public static class BuiltInDat
new() { Id = "to-html", Name = "HTML", TargetFormat = "html" },
.. SpreadsheetPresets(),
.. CatalogPresets(),
+ .. DataPresets(),
+ .. CodecAndSubtitlePresets(),
+ .. ModelPresets(),
];
+ /// <summary>
+ /// HEVC / AV1 video, ALAC and the subtitle targets (added in settings schema 11, see SettingsMigrations).
+ /// </summary>
+ public static List<Preset> CodecAndSubtitlePresets() =>
+ [
+ // Video codecs and lossless audio
+ new()
+ {
+ Id = "mp4-hevc", Name = "MP4 HEVC", TargetFormat = "mp4",
+ Media = { VideoCodec = VideoCodec.Hevc }, Output = { FileNamePattern = "{name}_hevc" },
+ },
+ new()
+ {
+ Id = "mp4-av1", Name = "MP4 AV1", TargetFormat = "mp4",
+ Media = { VideoCodec = VideoCodec.Av1 }, Output = { FileNamePattern = "{name}_av1" },
+ },
+ new() { Id = "to-alac", Name = "ALAC", TargetFormat = "m4a", Media = { AudioCodec = AudioCodec.Alac } },
+
+ // Subtitles; on the video donut, SRT takes the first text subtitle track out of the video.
+ new() { Id = "extract-subtitles", NameKey = "preset.extract_subtitles", TargetFormat = "srt" },
+ new() { Id = "to-srt", Name = "SRT", TargetFormat = "srt" },
+ new() { Id = "to-vtt", Name = "WebVTT", TargetFormat = "vtt" },
+ new() { Id = "to-ass", Name = "ASS", TargetFormat = "ass" },
+ new() { Id = "to-smi", Name = "SAMI", TargetFormat = "smi" },
+ new() { Id = "to-lrc", Name = "LRC", TargetFormat = "lrc" },
+ new() { Id = "to-ttml", Name = "TTML", TargetFormat = "ttml" },
+ ];
+
/// <summary>HWP as a target, through HWPX (added in settings schema 7, see SettingsMigrations).</summary>
public static List<Preset> HwpPresets() =>
[
@@@ -90,17 -119,6 +120,17 @@@
new() { Id = "to-csv", Name = "CSV", TargetFormat = "csv" },
];
- /// <summary>3D model targets (added in settings schema 11, see SettingsMigrations). glTF is on no donut: GLB is the same in one file.</summary>
++ /// <summary>3D model targets (added in settings schema 15, see SettingsMigrations). glTF is on no donut: GLB is the same in one file.</summary>
+ public static List<Preset> ModelPresets() =>
+ [
+ new() { Id = "to-glb", Name = "GLB", TargetFormat = "glb" },
+ new() { Id = "to-stl", Name = "STL", TargetFormat = "stl" },
+ new() { Id = "to-obj", Name = "OBJ", TargetFormat = "obj" },
+ new() { Id = "to-3mf", Name = "3MF", TargetFormat = "3mf" },
+ new() { Id = "to-ply", Name = "PLY", TargetFormat = "ply" },
+ new() { Id = "to-gltf", Name = "glTF", TargetFormat = "gltf" },
+ ];
+
/// <summary>
/// Targets of the formats added in settings schema 6: images, vector, office, e-books, video, audio, archives,
/// CAD and fonts (see SettingsMigrations).
@@@ -207,8 -240,8 +252,9 @@@
PresetIds = ["to-pdf", "to-docx", "to-hwpx", "to-hwp", "to-png", "to-jpg", "to-txt", "to-md", "to-epub", "merge-pdf"],
},
TextProfile(),
- .. CatalogProfiles(),
+ .. WithSubtitleProfile(CatalogProfiles()),
+ DataProfile(),
+ ModelProfile(),
new()
{
Id = "mixed", NameKey = "profile.mixed", IsFallback = true,
@@@ -290,15 -323,31 +336,40 @@@
},
];
- /// <summary>3D models: GLB, glTF, STL, OBJ, 3MF, PLY (added in settings schema 11, after "fonts").</summary>
+ /// <summary>JSON, YAML, TOML, XML and vCard files (added in settings schema 14, after "fonts").</summary>
+ public static ToolbarProfile DataProfile() => new()
+ {
+ Id = "data",
+ NameKey = "profile.data",
+ Extensions = ExtensionsOf(FormatCategory.Data),
+ PresetIds = ["to-json", "to-yaml", "to-toml", "to-xml", "to-csv", "to-xlsx"],
+ };
+
+ /// <summary>Text subtitles: SRT, ASS, WebVTT, SAMI, LRC, ... (added in settings schema 11, after "audio").</summary>
+ public static ToolbarProfile SubtitleProfile() => new()
+ {
+ Id = "subtitles",
+ NameKey = "profile.subtitles",
+ Extensions = ExtensionsOf(FormatCategory.Subtitle),
+ PresetIds = ["to-srt", "to-vtt", "to-ass", "to-smi", "to-lrc", "to-ttml"],
+ };
+
+ /// <summary><paramref name="profiles"/> with the subtitle donut after the audio donut.</summary>
+ private static List<ToolbarProfile> WithSubtitleProfile(List<ToolbarProfile> profiles)
+ {
+ profiles.Insert(profiles.FindIndex(p => p.Id == "audio") + 1, SubtitleProfile());
+ return profiles;
+ }
+
++ /// <summary>3D models: GLB, glTF, STL, OBJ, 3MF, PLY (added in settings schema 15, after "data").</summary>
+ public static ToolbarProfile ModelProfile() => new()
+ {
+ Id = "models",
+ NameKey = "profile.models",
+ Extensions = ExtensionsOf(FormatCategory.Model3D),
+ PresetIds = ["to-glb", "to-stl", "to-obj", "to-3mf", "to-ply", "to-png"],
+ };
+
/// <summary>Every file extension of the formats in <paramref name="category"/>.</summary>
public static List<string> ExtensionsOf(FormatCategory category) =>
FormatRegistry.Known.Where(f => f.Category == category)
diff --cc src/Filee.Core/Settings/AppSettings.cs
index ce93770b,ffe29dc2..6af60ecf
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@@ -50,7 -50,7 +50,7 @@@ public sealed class DonutSetting
public sealed class AppSettings
{
/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>
- public const int CurrentSchemaVersion = 11;
- public const int CurrentSchemaVersion = 14;
++ public const int CurrentSchemaVersion = 15;
public int SchemaVersion { get; set; } = CurrentSchemaVersion;
@@@ -89,8 -89,8 +89,8 @@@
public List<string> EnginePriority { get; set; } =
[
"magick", "pdfium", "pdfsharp", "rhwp", "unhwp", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer",
- "pdf-text", "email", "vector", "icns", "font", "cad", "model3d", "archive", "ebook", "ffmpeg", "pandoc", "ghostscript", "calibre",
- "libreoffice",
- "pdf-text", "email", "data", "vector", "icns", "font", "cad", "archive", "ebook", "subtitle", "ffmpeg", "pandoc",
- "ghostscript", "calibre", "libreoffice",
++ "pdf-text", "email", "data", "vector", "icns", "font", "cad", "model3d", "archive", "ebook", "subtitle", "ffmpeg",
++ "pandoc", "ghostscript", "calibre", "libreoffice",
];
/// <summary>Set once the first-run welcome has been shown.</summary>
diff --cc src/Filee.Core/Settings/UserDataStore.cs
index 0204fead,f601dfea..5d14774c
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@@ -252,10 -252,20 +252,31 @@@ internal static class SettingsMigration
InsertBefore(settings.EnginePriority, id, "libreoffice");
}
- // v11: built-in "model3d" engine (3D models: GLB, glTF, STL, OBJ, 3MF, PLY), next to the CAD engine.
- if (settings.SchemaVersion < 11)
- InsertBefore(settings.EnginePriority, "model3d", "archive");
+ // v12: built-in "subtitle" engine (SRT, ASS, WebVTT, SAMI, LRC, TTML, ...), before FFmpeg.
+ if (settings.SchemaVersion < 12)
+ InsertBefore(settings.EnginePriority, "subtitle", "ffmpeg");
+
+ // v14: built-in "data" engine (JSON, YAML, TOML, XML, CSV, vCard), next to the e-mail engine.
+ if (settings.SchemaVersion < 14 && !settings.EnginePriority.Contains("data"))
+ {
+ var email = settings.EnginePriority.IndexOf("email");
+ if (email >= 0)
+ settings.EnginePriority.Insert(email + 1, "data");
+ else
+ InsertBefore(settings.EnginePriority, "data", "pandoc");
+ }
+
++ // v15: built-in "model3d" engine (3D models: GLB, glTF, STL, OBJ, 3MF, PLY), after the CAD engine (else before
++ // the archive engine, else before Pandoc like the other built-in engines).
++ if (settings.SchemaVersion < 15 && !settings.EnginePriority.Contains("model3d"))
++ {
++ var cad = settings.EnginePriority.IndexOf("cad");
++ if (cad >= 0)
++ settings.EnginePriority.Insert(cad + 1, "model3d");
++ else
++ InsertBefore(settings.EnginePriority, "model3d", settings.EnginePriority.Contains("archive") ? "archive" : "pandoc");
++ }
+
if (settings.Triggers.Count == 0)
settings.Triggers = TriggerGesture.Defaults();
@@@ -365,37 -375,118 +386,150 @@@
changed = true;
}
- // v11: 3D models (GLB, glTF, STL, OBJ, 3MF, PLY) get presets and their own donut after "fonts" (else before the
- // mixed-files one), with the extensions no donut of the user takes yet.
+ // v11: more document formats (Org, AsciiDoc, Typst, ... through Pandoc; flat OpenDocument, templates,
+ // ClarisWorks, ... through LibreOffice; KEPUB built in). Built-in donuts learn the new extensions unless
+ // another donut already has them, and the e-books donut gets KEPUB after MOBI.
if (from < 11)
+ {
+ if (presets.All(p => p.Id != "to-kepub"))
+ {
+ presets.Add(BuiltInData.CreatePresets().Single(p => p.Id == "to-kepub"));
+ changed = true;
+ changed |= Offer(presets, profiles, "ebooks", "to-kepub", "to-mobi");
+ }
+ changed |= LearnExtensions(profiles, out _);
+ }
+
+ // v12: HEVC / AV1 video, ALAC and the new audio formats (WavPack, TTA, APE, DSD, ...), and a subtitles donut
+ // after the audio donut. The video donut offers "MP4 HEVC" and "Extract subtitles".
+ if (from < 12)
+ changed |= AddCodecsAndSubtitles(presets, profiles);
+
+ // v13: more image formats (APNG, MNG, QOI, DDS, DICOM, OpenEXR, …, Fujifilm's .hif): the images donut learns
+ // their extensions unless another donut already has them.
+ if (from < 13)
+ changed |= LearnExtensions(profiles, out _);
+
+ // v14: structured data (JSON, YAML, TOML, XML, vCard) gets its own donut after "fonts", Outlook MSG joins
+ // the documents donut next to EML, and the spreadsheets donut gets JSON after CSV.
+ if (from < 14)
+ changed |= AddData(presets, profiles);
++
++ // v15: 3D models (GLB, glTF, STL, OBJ, 3MF, PLY) get presets and their own donut after "data" (else after
++ // "fonts", else before the mixed-files one), with the extensions no donut of the user takes yet.
++ if (from < 15)
+ changed |= AddModels(presets, profiles);
return changed;
}
+ private static bool AddData(List<Preset> presets, List<ToolbarProfile> profiles)
+ {
+ var changed = false;
+ foreach (var preset in BuiltInData.DataPresets().Where(p => presets.All(existing => existing.Id != p.Id)))
+ {
+ presets.Add(preset);
+ changed = true;
+ }
+ changed |= LearnExtensions(profiles, out var claimed);
+
+ if (profiles.All(p => p.Id != "data"))
+ {
+ var data = BuiltInData.DataProfile();
+ // Only the extensions no donut of the user takes yet.
+ data.Extensions = data.Extensions.Where(claimed.Add).ToList();
+ if (data.Extensions.Count > 0)
+ {
+ var presetIds = presets.Select(p => p.Id).ToHashSet();
+ data.PresetIds = data.PresetIds.Where(presetIds.Contains).ToList();
+ var fonts = profiles.FindIndex(p => p.Id == "fonts");
+ var insertAt = fonts >= 0 ? fonts + 1 : profiles.FindIndex(p => p.IsFallback);
+ profiles.Insert(insertAt < 0 ? profiles.Count : insertAt, data);
+ changed = true;
+ }
+ }
+
+ changed |= Offer(presets, profiles, "spreadsheets", "to-json", "to-csv");
+ return changed;
+ }
+
+ private static bool AddCodecsAndSubtitles(List<Preset> presets, List<ToolbarProfile> profiles)
+ {
+ var changed = false;
+ foreach (var preset in BuiltInData.CodecAndSubtitlePresets().Where(p => presets.All(existing => existing.Id != p.Id)))
+ {
+ presets.Add(preset);
+ changed = true;
+ }
+ changed |= LearnExtensions(profiles, out var claimed);
+
+ if (profiles.All(p => p.Id != "subtitles"))
+ {
+ var subtitles = BuiltInData.SubtitleProfile();
+ subtitles.Extensions = subtitles.Extensions.Where(claimed.Add).ToList();
+ if (subtitles.Extensions.Count > 0)
+ {
+ var ids = presets.Select(p => p.Id).ToHashSet();
+ subtitles.PresetIds = subtitles.PresetIds.Where(ids.Contains).ToList();
+ var audio = profiles.FindIndex(p => p.Id == "audio");
+ var insertAt = audio >= 0 ? audio + 1 : profiles.FindIndex(p => p.IsFallback);
+ profiles.Insert(insertAt < 0 ? profiles.Count : insertAt, subtitles);
+ changed = true;
+ }
+ }
+
+ changed |= Offer(presets, profiles, "video", "mp4-hevc", "mp4-720");
+ changed |= Offer(presets, profiles, "video", "extract-subtitles", "to-mp3");
+ return changed;
+ }
+
+ /// <summary>
+ /// Adds the default extensions of the built-in donuts that no donut of the user takes yet.
+ /// </summary>
+ /// <param name="claimed">Every extension a donut takes afterwards.</param>
+ private static bool LearnExtensions(List<ToolbarProfile> profiles, out HashSet<string> claimed)
+ {
+ var changed = false;
+ // Extensions checked on a mixed-selection profile only limit that profile; they don't claim files.
+ claimed = profiles.Where(p => !p.IsFallback).SelectMany(p => p.Extensions).ToHashSet(StringComparer.OrdinalIgnoreCase);
+ var defaults = BuiltInData.CreateProfiles().ToDictionary(p => p.Id);
+ foreach (var profile in profiles.Where(p => !p.IsFallback && defaults.ContainsKey(p.Id)))
+ {
+ foreach (var extension in defaults[profile.Id].Extensions.Where(claimed.Add))
+ {
+ profile.Extensions.Add(extension);
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ private static bool AddModels(List<Preset> presets, List<ToolbarProfile> profiles)
+ {
+ var changed = false;
+ foreach (var preset in BuiltInData.ModelPresets().Where(p => presets.All(existing => existing.Id != p.Id)))
+ {
+ presets.Add(preset);
+ changed = true;
+ }
++ changed |= LearnExtensions(profiles, out var claimed);
+ if (profiles.Any(p => p.Id == "models"))
+ return changed;
+
- var claimed = profiles.Where(p => !p.IsFallback).SelectMany(p => p.Extensions).ToHashSet(StringComparer.OrdinalIgnoreCase);
+ var models = BuiltInData.ModelProfile();
++ // Only the extensions no donut of the user takes yet.
+ models.Extensions = models.Extensions.Where(claimed.Add).ToList();
+ if (models.Extensions.Count == 0)
+ return changed;
+ var ids = presets.Select(p => p.Id).ToHashSet();
+ models.PresetIds = models.PresetIds.Where(ids.Contains).ToList();
- var fonts = profiles.FindIndex(p => p.Id == "fonts");
- var insertAt = fonts >= 0 ? fonts + 1 : profiles.FindIndex(p => p.IsFallback);
++ var after = profiles.FindIndex(p => p.Id == "data");
++ if (after < 0)
++ after = profiles.FindIndex(p => p.Id == "fonts");
++ var insertAt = after >= 0 ? after + 1 : profiles.FindIndex(p => p.IsFallback);
+ profiles.Insert(insertAt < 0 ? profiles.Count : insertAt, models);
+ return true;
+ }
+
private static bool AddCatalog(List<Preset> presets, List<ToolbarProfile> profiles)
{
var changed = false;
diff --cc src/Filee.Engines/EngineRegistry.cs
index f3683bbb,7db0533d..0a2e3a42
--- a/src/Filee.Engines/EngineRegistry.cs
+++ b/src/Filee.Engines/EngineRegistry.cs
@@@ -12,9 -13,9 +13,10 @@@ using Filee.Engines.Icns
using Filee.Engines.Infrastructure;
using Filee.Engines.Magick;
using Filee.Engines.Media;
+using Filee.Engines.Models3D;
using Filee.Engines.Office;
using Filee.Engines.Pdf;
+ using Filee.Engines.Subtitles;
using Filee.Engines.Text;
using Filee.Engines.Vector;
@@@ -46,9 -47,10 +48,11 @@@ public static class EngineRegistr
new DocxWriterConverter(),
new PdfTextConverter(),
new EmlConverter(),
+ new DataConverter(),
+ new SubtitleConverter(),
new FfmpegConverter(),
new CadConverter(),
+ new ModelConverter(),
new EbookConverter(),
new PandocConverter(),
new GhostscriptConverter(),
diff --cc src/Filee.Engines/Filee.Engines.csproj
index 98ccb89e,871484e8..98695b5f
--- a/src/Filee.Engines/Filee.Engines.csproj
+++ b/src/Filee.Engines/Filee.Engines.csproj
@@@ -28,7 -28,9 +28,10 @@@
<PackageReference Include="MimeKitLite" />
<PackageReference Include="ACadSharp" />
<PackageReference Include="AngleSharp" />
+ <PackageReference Include="YamlDotNet" />
+ <PackageReference Include="Tomlyn" />
+ <PackageReference Include="MsgReader" />
+ <PackageReference Include="SharpGLTF.Core" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
</ItemGroup>
diff --cc src/Filee.Engines/Models3D/StlFormat.cs
index 38c9b0cc,00000000..9c6168a3
mode 100644,000000..100644
--- a/src/Filee.Engines/Models3D/StlFormat.cs
+++ b/src/Filee.Engines/Models3D/StlFormat.cs
@@@ -1,219 -1,0 +1,219 @@@
+// STL (stereolithography): binary and ASCII. Triangles only, no units (read as millimetres), Z up, no colours,
+// UVs or materials. Binary files are streamed in blocks and vertices merged by position, so a 1,000,000-triangle
+// file needs about 40 MB.
+
+using System.Buffers.Binary;
+using System.Globalization;
+using System.Numerics;
+using System.Text;
+
+namespace Filee.Engines.Models3D;
+
+internal static class StlFormat
+{
+ private const int HeaderSize = 84;
+ private const int RecordSize = 50;
+
+ /// <summary>Bytes of an ASCII STL: printable ASCII, tab, CR and LF.</summary>
+ private static readonly System.Buffers.SearchValues<byte> TextBytes =
+ System.Buffers.SearchValues.Create([9, 10, 13, .. Enumerable.Range(32, 95).Select(b => (byte)b)]);
+
+ public static Model3D Read(string path, IProgress<double>? progress, CancellationToken cancellationToken)
+ {
+ using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1 << 20, FileOptions.SequentialScan);
+ var length = stream.Length;
+ Span<byte> header = stackalloc byte[HeaderSize];
+ var headerRead = stream.ReadAtLeast(header, HeaderSize, throwOnEndOfStream: false);
+ var count = headerRead == HeaderSize ? BinaryPrimitives.ReadUInt32LittleEndian(header[80..]) : 0;
+ var exactBinary = headerRead == HeaderSize && HeaderSize + (long)RecordSize * count == length;
+ var startsWithSolid = Encoding.ASCII.GetString(header[..headerRead]).TrimStart().StartsWith("solid", StringComparison.OrdinalIgnoreCase);
+ var fitsBinary = headerRead == HeaderSize && count > 0 && HeaderSize + (long)RecordSize * count <= length;
+ if (startsWithSolid && fitsBinary && !exactBinary)
+ {
+ // Some exporters start a binary header with "solid" and add bytes at the end: text has no control bytes.
+ Span<byte> sample = stackalloc byte[512];
+ var read = stream.ReadAtLeast(sample, sample.Length, throwOnEndOfStream: false);
+ startsWithSolid = !sample[..read].ContainsAnyExcept(TextBytes);
+ stream.Position = HeaderSize;
+ }
+
+ Model3D model;
+ if (exactBinary || (!startsWithSolid && fitsBinary))
+ {
+ model = ReadBinary(stream, (int)Math.Min(count, int.MaxValue / 3), progress, cancellationToken);
+ }
+ else if (startsWithSolid)
+ {
+ stream.Position = 0;
+ model = ReadAscii(stream, progress, cancellationToken);
+ }
+ else
+ {
+ throw new InvalidDataException(headerRead < HeaderSize
+ ? "The file is too short to be an STL file."
+ : $"The binary STL file is cut short: it announces {count:N0} triangles but holds only {(length - HeaderSize) / RecordSize:N0}.");
+ }
+
+ foreach (var part in model.Parts)
+ part.Transform(MeshMath.ZUpToYUp);
+ return model;
+ }
+
+ private static Model3D ReadBinary(Stream stream, int count, IProgress<double>? progress, CancellationToken cancellationToken)
+ {
+ var part = new MeshPart { Name = "STL" };
+ part.Indices.Capacity = count * 3;
+ var merger = new PositionMerger(part, count / 2);
+ var buffer = new byte[RecordSize * 4096];
+ var done = 0;
+ while (done < count)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ var batch = Math.Min(4096, count - done);
+ stream.ReadExactly(buffer, 0, batch * RecordSize);
+ for (var r = 0; r < batch; r++)
+ {
+ var record = buffer.AsSpan(r * RecordSize, RecordSize);
+ var a = ReadVector(record[12..]);
+ var b = ReadVector(record[24..]);
+ var c = ReadVector(record[36..]);
+ if (!Finite(a) || !Finite(b) || !Finite(c))
+ continue;
+ part.AddTriangle(merger.Add(a), merger.Add(b), merger.Add(c));
+ }
+ done += batch;
+ progress?.Report((double)done / count);
+ }
+ return new Model3D { Parts = { part } };
+
+ static Vector3 ReadVector(ReadOnlySpan<byte> data) => new(
+ BinaryPrimitives.ReadSingleLittleEndian(data),
+ BinaryPrimitives.ReadSingleLittleEndian(data[4..]),
+ BinaryPrimitives.ReadSingleLittleEndian(data[8..]));
+ }
+
+ private static Model3D ReadAscii(Stream stream, IProgress<double>? progress, CancellationToken cancellationToken)
+ {
+ var model = new Model3D();
+ MeshPart? part = null;
+ PositionMerger? merger = null;
+ Span<int> corners = stackalloc int[3];
+ var cornerCount = 0;
+ var length = Math.Max(1, stream.Length);
+ using var reader = new StreamReader(stream, Encoding.ASCII, detectEncodingFromByteOrderMarks: true, 1 << 16);
+ var lineNumber = 0;
+ while (reader.ReadLine() is { } line)
+ {
+ lineNumber++;
+ var text = line.AsSpan().Trim();
+ if (text.StartsWith("vertex", StringComparison.OrdinalIgnoreCase))
+ {
+ if (part is null)
+ {
+ part = new MeshPart { Name = "STL" };
+ merger = new PositionMerger(part, 1024);
+ model.Parts.Add(part);
+ }
+ var v = ParseVector(text[6..], lineNumber);
+ if (cornerCount < 3)
+ corners[cornerCount++] = merger!.Add(v);
+ }
+ else if (text.StartsWith("endloop", StringComparison.OrdinalIgnoreCase))
+ {
+ if (cornerCount == 3)
+ part!.AddTriangle(corners[0], corners[1], corners[2]);
+ cornerCount = 0;
+ }
+ else if (text.StartsWith("solid", StringComparison.OrdinalIgnoreCase))
+ {
+ part = new MeshPart { Name = text[5..].Trim().ToString() is { Length: > 0 } name ? name : "STL" };
+ merger = new PositionMerger(part, 1024);
+ model.Parts.Add(part);
+ }
+ if ((lineNumber & 0xFFFF) == 0)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ progress?.Report((double)stream.Position / length);
+ }
+ }
+ return model;
+ }
+
+ private static Vector3 ParseVector(ReadOnlySpan<char> text, int lineNumber)
+ {
+ Span<float> values = stackalloc float[3];
+ var found = 0;
- foreach (var range in text.Split(' '))
++ foreach (var range in text.SplitAny(' ', '\t'))
+ {
+ var token = text[range].Trim();
+ if (token.IsEmpty)
+ continue;
+ if (found == 3 || !float.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out values[found++]))
+ throw new InvalidDataException($"Line {lineNumber} of the STL file has an invalid vertex.");
+ }
+ if (found != 3)
+ throw new InvalidDataException($"Line {lineNumber} of the STL file has an invalid vertex.");
+ return new Vector3(values[0], values[1], values[2]);
+ }
+
+ private static bool Finite(Vector3 v) => float.IsFinite(v.X) && float.IsFinite(v.Y) && float.IsFinite(v.Z);
+
+ /// <summary>Writes a binary STL (Z up, millimetres) with every part in one solid and facet normals from the winding.</summary>
+ public static void Write(Model3D model, Stream output, CancellationToken cancellationToken)
+ {
+ using var stream = new BufferedStream(output, 1 << 20);
+ var header = new byte[HeaderSize];
+ Encoding.ASCII.GetBytes("Binary STL written by Filee").CopyTo(header, 0);
+ BinaryPrimitives.WriteUInt32LittleEndian(header.AsSpan(80), (uint)model.TriangleCount);
+ stream.Write(header);
+
+ Span<byte> record = stackalloc byte[RecordSize];
+ foreach (var part in model.Parts)
+ {
+ var indices = part.IndexSpan;
+ for (var t = 0; t + 2 < indices.Length; t += 3)
+ {
+ if ((t & 0xFFFF) == 0)
+ cancellationToken.ThrowIfCancellationRequested();
+ var a = MeshMath.ToZUp(part.Position(indices[t]));
+ var b = MeshMath.ToZUp(part.Position(indices[t + 1]));
+ var c = MeshMath.ToZUp(part.Position(indices[t + 2]));
+ var n = Vector3.Cross(b - a, c - a);
+ n = n.LengthSquared() > 0 ? Vector3.Normalize(n) : Vector3.Zero;
+ if (!float.IsFinite(n.X))
+ n = Vector3.Zero;
+ WriteVector(record, n);
+ WriteVector(record[12..], a);
+ WriteVector(record[24..], b);
+ WriteVector(record[36..], c);
+ record[48] = 0;
+ record[49] = 0;
+ stream.Write(record);
+ }
+ }
+
+ static void WriteVector(Span<byte> data, Vector3 v)
+ {
+ BinaryPrimitives.WriteSingleLittleEndian(data, v.X);
+ BinaryPrimitives.WriteSingleLittleEndian(data[4..], v.Y);
+ BinaryPrimitives.WriteSingleLittleEndian(data[8..], v.Z);
+ }
+ }
+}
+
+/// <summary>Adds positions to a part, reusing the vertex of an identical position.</summary>
+internal sealed class PositionMerger(MeshPart part, int capacity)
+{
+ private readonly Dictionary<Vector3, int> _seen = new(Math.Clamp(capacity, 16, 1 << 24));
+
+ public int Add(Vector3 position)
+ {
+ // -0 and 0 are the same point.
+ position += Vector3.Zero;
+ if (_seen.TryGetValue(position, out var index))
+ return index;
+ index = part.AddVertex(position);
+ _seen.Add(position, index);
+ return index;
+ }
+}
diff --cc tests/Filee.Core.Tests/UserDataStoreTests.cs
index 6080d851,0cd897b6..1ce4ce8c
--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs
+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs
@@@ -60,7 -60,7 +60,7 @@@ public class UserDataStoreTest
var store = new UserDataStore(dir.Path);
store.Load();
- Assert.Equal(["magick", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer", "pdf-text", "email", "vector", "icns", "font", "cad", "model3d", "archive", "ebook", "ffmpeg", "pandoc", "ghostscript", "calibre", "libreoffice"], store.Settings.EnginePriority);
- Assert.Equal(["magick", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer", "pdf-text", "email", "data", "vector", "icns", "font", "cad", "archive", "ebook", "subtitle", "ffmpeg", "pandoc", "ghostscript", "calibre", "libreoffice"], store.Settings.EnginePriority);
++ Assert.Equal(["magick", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer", "pdf-text", "email", "data", "vector", "icns", "font", "cad", "model3d", "archive", "ebook", "subtitle", "ffmpeg", "pandoc", "ghostscript", "calibre", "libreoffice"], store.Settings.EnginePriority);
Assert.Equal(AppSettings.CurrentSchemaVersion, store.Settings.SchemaVersion);
}
@@@ -112,7 -112,7 +112,7 @@@
var store = new UserDataStore(dir.Path);
store.Load();
- Assert.Equal(["magick", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer", "pdf-text", "email", "vector", "icns", "font", "cad", "model3d", "archive", "ebook", "ffmpeg", "pandoc", "ghostscript", "calibre", "libreoffice"], store.Settings.EnginePriority);
- Assert.Equal(["magick", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer", "pdf-text", "email", "data", "vector", "icns", "font", "cad", "archive", "ebook", "subtitle", "ffmpeg", "pandoc", "ghostscript", "calibre", "libreoffice"], store.Settings.EnginePriority);
++ Assert.Equal(["magick", "markdown", "spreadsheet", "ooxml", "hwpx-writer", "docx-writer", "pdf-text", "email", "data", "vector", "icns", "font", "cad", "model3d", "archive", "ebook", "subtitle", "ffmpeg", "pandoc", "ghostscript", "calibre", "libreoffice"], store.Settings.EnginePriority);
var ids = store.Profiles.Select(p => p.Id).ToList();
Assert.Equal(ids.IndexOf("office") + 1, ids.IndexOf("spreadsheets"));
Assert.Equal(ids.IndexOf("office") + 2, ids.IndexOf("presentations"));
@@@ -126,8 -126,9 +126,9 @@@
public void Version_5_libraries_get_the_format_catalog()
{
// As written by 1.0.x with schema 5: no catalog presets, donuts or extensions.
- var presets = BuiltInData.CreatePresets().Where(p => BuiltInData.CatalogPresets().All(c => c.Id != p.Id)).ToList();
- var catalogIds = BuiltInData.CatalogProfiles().Select(p => p.Id).Append("models").ToHashSet();
+ var presets = BuiltInData.CreatePresets()
- .Where(p => BuiltInData.CatalogPresets().Concat(BuiltInData.CodecAndSubtitlePresets()).All(c => c.Id != p.Id)).ToList();
- var catalogIds = BuiltInData.CatalogProfiles().Select(p => p.Id).Append("subtitles").ToHashSet();
++ .Where(p => BuiltInData.CatalogPresets().Concat(BuiltInData.CodecAndSubtitlePresets()).Concat(BuiltInData.ModelPresets()).All(c => c.Id != p.Id)).ToList();
++ var catalogIds = BuiltInData.CatalogProfiles().Select(p => p.Id).Append("subtitles").Append("models").ToHashSet();
var profiles = BuiltInData.CreateProfiles().Where(p => !catalogIds.Contains(p.Id)).ToList();
profiles.Single(p => p.Id == "images").Extensions = ["png", "jpg"];
profiles.Single(p => p.Id == "pdf").PresetIds.Remove("to-docx");
@@@ -139,8 -140,8 +140,10 @@@
var ids = profiles.Select(p => p.Id).ToList();
Assert.Equal(ids.IndexOf("text") + 1, ids.IndexOf("ebooks"));
- Assert.Equal(ids.IndexOf("fonts") + 1, ids.IndexOf("models"));
- Assert.Equal(ids.IndexOf("mixed") - 2, ids.IndexOf("fonts")); // then "data" (schema 14)
++ Assert.Equal(ids.IndexOf("fonts") + 1, ids.IndexOf("data")); // schema 14
++ Assert.Equal(ids.IndexOf("data") + 1, ids.IndexOf("models")); // schema 15
+ Assert.Equal(ids.IndexOf("mixed") - 1, ids.IndexOf("models"));
+ Assert.Equal(ids.IndexOf("audio") + 1, ids.IndexOf("subtitles"));
Assert.Contains("cr2", profiles.Single(p => p.Id == "images").Extensions);
Assert.DoesNotContain("mp3", profiles.Single(p => p.Id == "audio").Extensions);
Assert.Contains("flac", profiles.Single(p => p.Id == "audio").Extensions);
@@@ -212,36 -213,137 +215,170 @@@
}
[Fact]
- public void Version_10_libraries_get_3d_model_presets_and_their_donut_after_fonts()
+ public void Version_13_libraries_get_the_data_donut_msg_files_and_json_for_spreadsheets()
+ {
+ // As written with schema 13: no data presets or donut, no MSG on the documents donut, no JSON on the spreadsheets
+ // donut; and a donut of the user that already takes YAML.
+ var presets = BuiltInData.CreatePresets();
+ presets.RemoveAll(p => BuiltInData.DataPresets().Any(d => d.Id == p.Id));
+ var profiles = BuiltInData.CreateProfiles();
+ profiles.RemoveAll(p => p.Id == "data");
+ profiles.Single(p => p.Id == "office").Extensions.Remove("msg");
+ profiles.Single(p => p.Id == "spreadsheets").PresetIds.Remove("to-json");
+ profiles.Insert(0, new ToolbarProfile { Id = "mine", Name = "Mine", Extensions = ["yml"] });
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(13, presets, profiles));
+
+ Assert.All(BuiltInData.DataPresets(), d => Assert.Contains(presets, p => p.Id == d.Id));
+ var ids = profiles.Select(p => p.Id).ToList();
+ Assert.Equal(ids.IndexOf("fonts") + 1, ids.IndexOf("data"));
+ var data = profiles.Single(p => p.Id == "data");
+ Assert.Contains("json", data.Extensions);
+ Assert.Contains("yaml", data.Extensions);
+ Assert.DoesNotContain("yml", data.Extensions); // the user's donut keeps it
+ Assert.Equal(["to-json", "to-yaml", "to-toml", "to-xml", "to-csv", "to-xlsx"], data.PresetIds);
+ Assert.Contains("msg", profiles.Single(p => p.Id == "office").Extensions);
+ var sheets = profiles.Single(p => p.Id == "spreadsheets").PresetIds;
+ Assert.Equal(sheets.IndexOf("to-csv") + 1, sheets.IndexOf("to-json"));
+ Assert.DoesNotContain(profiles, p => p.PresetIds.Contains("to-eml") || p.PresetIds.Contains("to-vcf"));
+ Assert.False(SettingsMigrations.ApplyToLibrary(13, presets, profiles)); // once only
+
+ var all = profiles.SelectMany(p => p.Extensions).ToList();
+ Assert.Equal(all.Count, all.Distinct(StringComparer.OrdinalIgnoreCase).Count());
+ }
+
+ [Fact]
+ public void Version_13_settings_get_the_data_engine_after_email()
+ {
+ using var dir = new TempDir();
+ File.WriteAllText(Path.Combine(dir.Path, "settings.json"),
+ """{ "schemaVersion": 13, "enginePriority": ["magick", "email", "vector", "pandoc", "libreoffice"] }""");
+
+ var store = new UserDataStore(dir.Path);
+ store.Load();
+
- Assert.Equal(["magick", "email", "data", "vector", "pandoc", "libreoffice"], store.Settings.EnginePriority);
++ // ... and, from schema 15, the 3D model engine before Pandoc (no CAD or archive engine in this list).
++ Assert.Equal(["magick", "email", "data", "vector", "model3d", "pandoc", "libreoffice"], store.Settings.EnginePriority);
+ }
+
+ [Fact]
+ public void Version_12_libraries_open_the_new_image_formats_on_the_images_donut()
+ {
+ // As written with schema 12: the images donut knows no APNG, QOI, DICOM or .hif; a donut of the user takes DDS.
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles();
+ var images = profiles.Single(p => p.Id == "images");
+ images.Extensions.RemoveAll(e => e is "apng" or "qoi" or "dcm" or "hif" or "dds");
+ profiles.Insert(0, new ToolbarProfile { Id = "game", Name = "Game textures", Extensions = ["dds"] });
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(12, presets, profiles));
+
+ Assert.Contains("apng", images.Extensions);
+ Assert.Contains("qoi", images.Extensions);
+ Assert.Contains("dcm", images.Extensions);
+ Assert.Contains("hif", images.Extensions);
+ Assert.DoesNotContain("dds", images.Extensions);
+ Assert.False(SettingsMigrations.ApplyToLibrary(12, presets, profiles)); // once only
+ }
+
+ [Fact]
+ public void Version_11_libraries_get_codecs_new_audio_formats_and_a_subtitles_donut()
+ {
+ // As written with schema 11: no HEVC / AV1 / ALAC / subtitle presets, no subtitles donut, the video donut and
+ // the audio extensions of that time, and a donut of the user that already takes .ape.
+ var added = BuiltInData.CodecAndSubtitlePresets().Select(p => p.Id).ToHashSet();
+ var presets = BuiltInData.CreatePresets().Where(p => !added.Contains(p.Id)).ToList();
+ var profiles = BuiltInData.CreateProfiles().Where(p => p.Id != "subtitles").ToList();
+ foreach (var profile in profiles)
+ profile.PresetIds.RemoveAll(added.Contains);
+ var audio = profiles.Single(p => p.Id == "audio");
+ audio.Extensions.RemoveAll(e => e is "wv" or "tta" or "w64" or "eac3" or "ec3" or "ape" or "mpc" or "mpp" or "mp+" or "tak"
+ or "dsf" or "dff" or "dts" or "spx");
+ profiles.Insert(0, new ToolbarProfile { Id = "mine", Name = "Mine", Extensions = ["ape"] });
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(11, presets, profiles));
+
+ Assert.Contains("wv", audio.Extensions);
+ Assert.Contains("dsf", audio.Extensions);
+ Assert.DoesNotContain("ape", audio.Extensions); // the user's donut keeps it
+ var ids = profiles.Select(p => p.Id).ToList();
+ Assert.Equal(ids.IndexOf("audio") + 1, ids.IndexOf("subtitles"));
+ Assert.Equal(BuiltInData.SubtitleProfile().PresetIds, profiles.Single(p => p.Id == "subtitles").PresetIds);
+ Assert.Contains("smi", profiles.Single(p => p.Id == "subtitles").Extensions);
+ Assert.Equal(BuiltInData.CreateProfiles().Single(p => p.Id == "video").PresetIds, profiles.Single(p => p.Id == "video").PresetIds);
+ Assert.Equal(VideoCodec.Hevc, presets.Single(p => p.Id == "mp4-hevc").Media.VideoCodec);
+ Assert.Equal(AudioCodec.Alac, presets.Single(p => p.Id == "to-alac").Media.AudioCodec);
+ Assert.DoesNotContain(profiles, p => p.PresetIds.Contains("to-alac") || p.PresetIds.Contains("mp4-av1"));
+ var all = profiles.SelectMany(p => p.Extensions).ToList();
+ Assert.Equal(all.Count, all.Distinct(StringComparer.OrdinalIgnoreCase).Count());
+ Assert.False(SettingsMigrations.ApplyToLibrary(11, presets, profiles)); // once only
+ }
+
+ [Fact]
+ public void Version_10_libraries_get_kepub_and_the_new_document_extensions()
+ {
+ // As written by 1.11.x: no KEPUB preset, and the donuts without the formats added in schema 11.
+ string[] added = ["org", "adoc", "typ", "mediawiki", "wiki", "dbk", "ipynb", "fodt", "ott", "cwk", "602", "ots", "fods", "otp", "fodp", "fodg", "kepub.epub"];
+ var presets = BuiltInData.CreatePresets();
+ presets.RemoveAll(p => p.Id == "to-kepub");
+ var profiles = BuiltInData.CreateProfiles();
+ foreach (var profile in profiles)
+ {
+ profile.PresetIds.Remove("to-kepub");
+ profile.Extensions.RemoveAll(added.Contains);
+ }
+ // A donut of the user already handles Org files.
+ profiles.Insert(0, new ToolbarProfile { Id = "mine", Name = "Mine", Extensions = ["org"] });
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(10, presets, profiles));
+
+ Assert.Equal("kepub", presets.Single(p => p.Id == "to-kepub").TargetFormat);
+ var ebooks = profiles.Single(p => p.Id == "ebooks");
+ Assert.Equal(ebooks.PresetIds.IndexOf("to-mobi") + 1, ebooks.PresetIds.IndexOf("to-kepub"));
+ Assert.Contains("kepub.epub", ebooks.Extensions);
+ Assert.Contains("typ", profiles.Single(p => p.Id == "text").Extensions);
+ Assert.DoesNotContain("org", profiles.Single(p => p.Id == "text").Extensions);
+ Assert.Contains("fodt", profiles.Single(p => p.Id == "office").Extensions);
+ Assert.Contains("fods", profiles.Single(p => p.Id == "spreadsheets").Extensions);
+ Assert.Contains("otp", profiles.Single(p => p.Id == "presentations").Extensions);
+ Assert.Contains("fodg", profiles.Single(p => p.Id == "vector").Extensions);
+ foreach (var expected in BuiltInData.CreateProfiles())
+ Assert.Equal(expected.PresetIds, profiles.Single(p => p.Id == expected.Id).PresetIds);
+ Assert.False(SettingsMigrations.ApplyToLibrary(10, presets, profiles)); // once only
+ }
+
++ [Fact]
++ public void Version_14_libraries_get_3d_model_presets_and_their_donut_after_data()
+ {
- // As written by 1.10.x: no 3D formats.
++ // As written with schema 14: no 3D formats.
+ var modelIds = BuiltInData.ModelPresets().Select(p => p.Id).ToHashSet();
+ var presets = BuiltInData.CreatePresets().Where(p => !modelIds.Contains(p.Id)).ToList();
+ var profiles = BuiltInData.CreateProfiles().Where(p => p.Id != "models").ToList();
+
- Assert.True(SettingsMigrations.ApplyToLibrary(10, presets, profiles));
++ Assert.True(SettingsMigrations.ApplyToLibrary(14, presets, profiles));
+
+ Assert.Equal(["to-glb", "to-stl", "to-obj", "to-3mf", "to-ply", "to-gltf"], presets.Where(p => modelIds.Contains(p.Id)).Select(p => p.Id));
+ var ids = profiles.Select(p => p.Id).ToList();
- Assert.Equal(ids.IndexOf("fonts") + 1, ids.IndexOf("models"));
++ Assert.Equal(ids.IndexOf("data") + 1, ids.IndexOf("models"));
++ Assert.Equal(ids.IndexOf("mixed") - 1, ids.IndexOf("models"));
+ var models = profiles.Single(p => p.Id == "models");
+ Assert.Equal(["glb", "gltf", "stl", "obj", "3mf", "ply"], models.Extensions);
+ Assert.Equal(BuiltInData.ModelProfile().PresetIds, models.PresetIds);
- Assert.False(SettingsMigrations.ApplyToLibrary(10, presets, profiles)); // once only
++ Assert.False(SettingsMigrations.ApplyToLibrary(14, presets, profiles)); // once only
+ }
+
+ [Fact]
+ public void The_3d_donut_leaves_out_extensions_a_profile_of_the_user_takes()
+ {
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles().Where(p => p.Id != "models").ToList();
+ profiles.Insert(0, new ToolbarProfile { Id = "printing", Name = "Printing", Extensions = ["stl", "3mf"] });
+
- Assert.True(SettingsMigrations.ApplyToLibrary(10, presets, profiles));
++ Assert.True(SettingsMigrations.ApplyToLibrary(14, presets, profiles));
+
+ Assert.Equal(["glb", "gltf", "obj", "ply"], profiles.Single(p => p.Id == "models").Extensions);
+ }
+
[Fact]
public void Catalog_migration_ignores_extensions_checked_on_mixed_profiles()
{