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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Merge remote-tracking branch 'origin/main' into feature/browser-drops
KnifeLemon6aede854c81d
diff --cc src/Filee.App/Services/ConversionService.csindex 2104f2ac,894637a6..5d35256f--- a/src/Filee.App/Services/ConversionService.cs+++ b/src/Filee.App/Services/ConversionService.cs@@@ -61,28 -58,14 +61,28 @@@ public sealed class ConversionServic/// <param name="files">Source files.</param>/// <param name="preset">Preset to apply.</param>/// <param name="showInToast">False when another view (the donut's progress ring) displays the job first.</param>+ /// <param name="web">+ /// The browser drop <paramref name="files"/> stand for: the job saves them first, into the folder Settings ›+ /// General names for files from a browser. The job owns it from now on (disposed here when nothing starts).+ /// </param>/// <returns>The job's view model, or null when there was nothing to convert.</returns>- public JobViewModel? Start(IReadOnlyList<string> files, Preset preset, bool showInToast = true)+ public JobViewModel? Start(IReadOnlyList<string> files, Preset preset, bool showInToast = true, WebDrop? web = null){- if (files.Count == 0 || preset.IsGroup)+ if (files.Count == 0 || preset.IsGroup || preset.IsTool)+ {+ web?.Dispose();return null;+ }// A preset on "Default" saves where Settings > General says (read now, so a changed default applies at once).preset = _store.Settings.WithDefaultOutput(preset);- var job = _queue.Enqueue(files, preset, _loc.DisplayName(preset));+ WebDropFetcher? fetcher = null;+ if (web is not null)+ {+ fetcher = web.CreateFetcher(BrowserDropOptions(), _downloader);+ // "Next to the source" is the download folder, also when the original is only kept until converted.+ preset = fetcher.Apply(preset);+ }+ var job = _queue.Enqueue(files, preset, _loc.DisplayName(preset), fetcher);var vm = new JobViewModel(job, _loc, _platform, Remove, RetryFailed);_byId[job.Id] = vm;Jobs.Insert(0, vm);@@@ -115,14 -98,6 +115,44 @@@return Start(files, preset);}++ /// <summary>++ /// Saves a browser drop's files for a tool (the crop overlay), which needs them on disk before anything else++ /// happens: always into the download folder, as the tool shows and keeps working on the original. Files that can't++ /// be saved are left out (<paramref name="failed"/> hears why). The drop is done afterwards.++ /// </summary>++ public async Task<IReadOnlyList<string>> SaveBrowserFilesAsync(WebDrop web, Action<string, Exception> failed)++ {++ try++ {++ var fetcher = web.CreateFetcher(BrowserDropOptions() with { SaveOnlyConverted = false }, _downloader);++ var saved = new List<string>();++ foreach (var placeholder in web.Placeholders)++ {++ try++ {++ saved.Add(await fetcher.FetchAsync(placeholder, new Progress<double>(), CancellationToken.None));++ }++ catch (Exception ex) when (ex is not OutOfMemoryException)++ {++ failed(placeholder, ex);++ }++ }++ return saved;++ }++ finally++ {++ web.Dispose();++ }++ }+++ /// <summary>Where files dragged from a browser are saved, as Settings › General says now.</summary>+ public WebDropOptions BrowserDropOptions()+ {+ var settings = _store.Settings.BrowserDrops;+ var folder = string.IsNullOrWhiteSpace(settings.Folder) ? _platform.DownloadsFolder : settings.Folder.Trim();+ return new WebDropOptions(folder, settings.SaveOnlyConverted);+ }+/// <summary>True when a source file (or folder) is still where it was.</summary>public static bool Exists(string path) => File.Exists(path) || Directory.Exists(path);diff --cc src/Filee.App/Services/RadialController.csindex e573412f,a499ae4b..46def1f3--- a/src/Filee.App/Services/RadialController.cs+++ b/src/Filee.App/Services/RadialController.cs@@@ -294,9 -271,16 +294,20 @@@ public sealed class RadialControllerreturn;}+ if (preset.IsTool)+ {+ var near = _window?.Position;+ Close(animate: false);- windows.ShowCropOverlay(files, preset, near);++ if (web is null)++ windows.ShowCropOverlay(files, preset, near);++ else++ _ = ShowToolForBrowserFilesAsync(web, preset, near);+ return;+ }+- log.LogInformation("Converting {Count} file(s) with preset {Preset}", files.Count, preset.Id);- var job = conversions.Start(files, preset, showInToast: false);+ log.LogInformation("Converting {Count} file(s) with preset {Preset}{Web}", files.Count, preset.Id,+ web is null ? "" : " (from a browser)");+ var job = conversions.Start(files, preset, showInToast: false, web);if (job is null || _window is null){Close();@@@ -306,6 -290,6 +317,15 @@@ShowProgress(job);}++ /// <summary>The crop tool on files from a browser: they are saved first, then it opens on them.</summary>++ private async Task ShowToolForBrowserFilesAsync(WebDrop web, Filee.Core.Presets.Preset preset, PixelPoint? near)++ {++ var files = await conversions.SaveBrowserFilesAsync(web, (placeholder, ex) =>++ log.LogWarning(ex, "Saving {File} from a browser for {Preset} failed", Path.GetFileName(placeholder), preset.Id));++ if (files.Count > 0)++ windows.ShowCropOverlay(files, preset, near);++ }++// ───────── Progress ring ─────────private void ShowProgress(JobViewModel job)