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 branch 'upstream/main' into feature/translate-text

return {name:"chinchi-codes"}3f2be7ac8edf
diff --cc src/Filee.App/Services/EngineDownloadService.cs
index 76a15e85,66a522c2..88b23b11
--- a/src/Filee.App/Services/EngineDownloadService.cs
+++ b/src/Filee.App/Services/EngineDownloadService.cs
@@@ -225,27 -209,24 +222,28 @@@ public sealed class EngineDownloadServi
}
/// <summary>
- /// In the order the engines look: the user's own copy, Filee's download, a copy on the PC. A copy Filee didn't
- /// download gets its version checked in the background (<see cref="EnginePackageState.UpdateNote"/>).
+ /// The copy the engines use (<see cref="EngineInstaller.StatusOf"/>). A copy Filee didn't download gets its
+ /// version checked in the background (<see cref="EnginePackageState.UpdateNote"/>).
/// </summary>
+ private static readonly HttpClient SharedOllamaClient = new() { Timeout = TimeSpan.FromMilliseconds(250) };
+
private EnginePackageStatus StatusOf(EnginePackageState state)
{
- var id = state.Package.Id;
- if (id == "translator")
++ if (state.Package.Id == "translator")
+ return StatusOfTranslator(state);
- var own = EngineEnvironment.OwnCopyFolder(id);
- var system = own is null && !_installer.IsInstalled(state.Package) ? EngineEnvironment.SystemCopyFolder(id) : null;
- state.OwnCopyFolder = own ?? system;
- state.FromSystem = system is not null;
+ var copy = _installer.StatusOf(state.Package);
+ state.OwnCopyFolder = copy.Folder;
+ state.FromSystem = copy.FromSystem;
state.UpdateNote = null;
- state.IsOutdated = state.OwnCopyFolder is null && _installer.IsInstalled(state.Package) && !_installer.IsUpToDate(state.Package);
- if (state.OwnCopyFolder is { } folder)
+ state.IsOutdated = copy.Outdated;
+ if (copy.Folder is { } folder)
_ = CheckVersionAsync(state, folder);
- return state.OwnCopyFolder is not null ? EnginePackageStatus.OwnCopy
- : _installer.IsInstalled(state.Package) ? EnginePackageStatus.Installed
- : EnginePackageStatus.NotInstalled;
+ return copy.Status switch
+ {
+ EngineCopyStatus.OwnCopy => EnginePackageStatus.OwnCopy,
+ EngineCopyStatus.Installed => EnginePackageStatus.Installed,
+ _ => EnginePackageStatus.NotInstalled,
+ };
}
/// <summary>Runs the copy's version check off the UI thread (it starts the program once) and notes an old one.</summary>