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.

Setup: slides on the progress card, no menu re-registration on update, update text on two lines

KnifeLemon44ed196871a7
diff --git a/src/Filee.App/App.axaml.cs b/src/Filee.App/App.axaml.cs
index cbc53b83..c7077c3d 100644
--- a/src/Filee.App/App.axaml.cs
+++ b/src/Filee.App/App.axaml.cs
@@ -146,11 +146,13 @@ public partial class App : Application
AppHost.Get<WatchFolderService>().DisposeAsync().AsTask().Wait(TimeSpan.FromSeconds(5));
};
- // Before HandleCommandLine marks the first run complete: a fresh install gets no slides. Without the main
- // window (sign-in, the Explorer menu) they wait until the user opens Filee, unless the installer asked for them.
+ // Before HandleCommandLine marks the first run complete: a fresh install gets no slides (an update by the
+ // installer does, even when its settings are gone). Without the main window (sign-in, the Explorer menu) they
+ // wait until the user opens Filee, unless the installer asked for them.
AppHost.Get<WhatsNewService>().CheckAtStartup(
background: Program.Options.Background && !Program.Options.ShowSettings && !Program.Options.WhatsNew
- || Program.Options.ConvertFiles.Count > 0);
+ || Program.Options.ConvertFiles.Count > 0,
+ updated: Program.Options.WhatsNew);
HandleCommandLine(Program.Options, firstLaunch: true);
if (OperatingSystem.IsMacOS())
this.TryGetFeature<IActivatableLifetime>()?.Activated += (_, e) =>
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index 7ba63796..729fd2ce 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -704,7 +704,7 @@
"installer.install": "Install",
"installer.update": "Update",
"installer.welcome.fresh": "Setup installs Filee {0} on this computer.",
- "installer.welcome.update": "Filee {0} is installed. Setup updates it to {1}; your settings, presets and engines stay as they are.",
+ "installer.welcome.update": "Filee {0} is installed.\nSetup updates it to {1}; your settings, presets and engines stay as they are.",
"installer.welcome.license": "Filee is free and open source (MIT license).",
"installer.language": "Language",
"installer.options.title": "Options",
diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.json
index ccc77450..0f1373b2 100644
--- a/src/Filee.App/Assets/i18n/es.json
+++ b/src/Filee.App/Assets/i18n/es.json
@@ -684,7 +684,7 @@
"installer.install": "Instalar",
"installer.update": "Actualizar",
"installer.welcome.fresh": "El instalador instalará Filee {0} en este equipo.",
- "installer.welcome.update": "Filee {0} está instalado. El instalador lo actualizará a {1}; tus ajustes, ajustes preestablecidos y motores se mantienen.",
+ "installer.welcome.update": "Filee {0} está instalado.\nEl instalador lo actualizará a {1}; tus ajustes, ajustes preestablecidos y motores se mantienen.",
"installer.welcome.license": "Filee es libre y de código abierto (licencia MIT).",
"installer.language": "Idioma",
"installer.options.title": "Opciones",
diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.json
index 86f27693..ed64da73 100644
--- a/src/Filee.App/Assets/i18n/hi.json
+++ b/src/Filee.App/Assets/i18n/hi.json
@@ -684,7 +684,7 @@
"installer.install": "इंस्टॉल करें",
"installer.update": "अपडेट करें",
"installer.welcome.fresh": "सेटअप इस कंप्यूटर पर Filee {0} इंस्टॉल करेगा।",
- "installer.welcome.update": "Filee {0} पहले से इंस्टॉल है। सेटअप इसे {1} में अपडेट करेगा; आपकी सेटिंग्स, प्रीसेट और इंजन वैसे ही रहेंगे।",
+ "installer.welcome.update": "Filee {0} पहले से इंस्टॉल है।\nसेटअप इसे {1} में अपडेट करेगा; आपकी सेटिंग्स, प्रीसेट और इंजन वैसे ही रहेंगे।",
"installer.welcome.license": "Filee मुफ़्त और ओपन सोर्स है (MIT लाइसेंस)।",
"installer.language": "भाषा",
"installer.options.title": "विकल्प",
diff --git a/src/Filee.App/Assets/i18n/ja.json b/src/Filee.App/Assets/i18n/ja.json
index 7fcf9d92..aaf00885 100644
--- a/src/Filee.App/Assets/i18n/ja.json
+++ b/src/Filee.App/Assets/i18n/ja.json
@@ -684,7 +684,7 @@
"installer.install": "インストール",
"installer.update": "更新",
"installer.welcome.fresh": "このコンピューターにFilee {0}をインストールします。",
- "installer.welcome.update": "Filee {0}がインストールされています。{1}に更新します。設定、プリセット、エンジンはそのまま残ります。",
+ "installer.welcome.update": "Filee {0}がインストールされています。\n{1}に更新します。設定、プリセット、エンジンはそのまま残ります。",
"installer.welcome.license": "Fileeは無料のオープンソースソフトウェアです(MITライセンス)。",
"installer.language": "言語",
"installer.options.title": "オプション",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 8d5bbc26..d879efa8 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -704,7 +704,7 @@
"installer.install": "설치",
"installer.update": "업데이트",
"installer.welcome.fresh": "이 컴퓨터에 Filee {0} 버전을 설치해요.",
- "installer.welcome.update": "Filee {0} 버전이 설치되어 있어요. {1} 버전으로 업데이트하고, 설정·프리셋·엔진은 그대로 둬요.",
+ "installer.welcome.update": "Filee {0} 버전이 설치되어 있어요.\n{1} 버전으로 업데이트하고, 설정·프리셋·엔진은 그대로 둬요.",
"installer.welcome.license": "Filee는 무료 오픈 소스예요 (MIT 라이선스).",
"installer.language": "언어",
"installer.options.title": "옵션",
diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.json
index 03f62338..75996fe4 100644
--- a/src/Filee.App/Assets/i18n/pl.json
+++ b/src/Filee.App/Assets/i18n/pl.json
@@ -704,7 +704,7 @@
"installer.install": "Zainstaluj",
"installer.update": "Zaktualizuj",
"installer.welcome.fresh": "Instalator zainstaluje Filee {0} na tym komputerze.",
- "installer.welcome.update": "Filee {0} jest zainstalowany. Instalator zaktualizuje go do wersji {1}; ustawienia, ustawienia wstępne i silniki pozostaną bez zmian.",
+ "installer.welcome.update": "Filee {0} jest zainstalowany.\nInstalator zaktualizuje go do wersji {1}; ustawienia, ustawienia wstępne i silniki pozostaną bez zmian.",
"installer.welcome.license": "Filee jest darmowy i ma otwarty kod źródłowy (licencja MIT).",
"installer.language": "Język",
"installer.options.title": "Opcje",
diff --git a/src/Filee.App/Assets/i18n/ru.json b/src/Filee.App/Assets/i18n/ru.json
index eb9ccc08..df8f2657 100644
--- a/src/Filee.App/Assets/i18n/ru.json
+++ b/src/Filee.App/Assets/i18n/ru.json
@@ -704,7 +704,7 @@
"installer.install": "Установить",
"installer.update": "Обновить",
"installer.welcome.fresh": "Программа установит Filee {0} на этот компьютер.",
- "installer.welcome.update": "Filee {0} уже установлен. Программа обновит его до версии {1}; настройки, пресеты и движки останутся как есть.",
+ "installer.welcome.update": "Filee {0} уже установлен.\nПрограмма обновит его до версии {1}; настройки, пресеты и движки останутся как есть.",
"installer.welcome.license": "Filee — бесплатная программа с открытым исходным кодом (лицензия MIT).",
"installer.language": "Язык",
"installer.options.title": "Параметры",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 0989b9d2..c2ce617a 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -704,7 +704,7 @@
"installer.install": "安装",
"installer.update": "更新",
"installer.welcome.fresh": "安装程序将在这台电脑上安装 Filee {0}。",
- "installer.welcome.update": "已安装 Filee {0}。安装程序会将其更新到 {1},设置、预设和引擎保持不变。",
+ "installer.welcome.update": "已安装 Filee {0}。\n安装程序会将其更新到 {1},设置、预设和引擎保持不变。",
"installer.welcome.license": "Filee 是免费的开源软件(MIT 许可证)。",
"installer.language": "语言",
"installer.options.title": "选项",
diff --git a/src/Filee.App/Services/WhatsNewService.cs b/src/Filee.App/Services/WhatsNewService.cs
index 04db38b7..6c946c58 100644
--- a/src/Filee.App/Services/WhatsNewService.cs
+++ b/src/Filee.App/Services/WhatsNewService.cs
@@ -5,7 +5,8 @@
// (the first-run setup introduces Filee; the slides would only repeat it), so the current version counts as seen.
// After that, WhatsNewSeenVersion says which version's slides were seen; null means the settings come from a Filee
// older than the slides, i.e. it was updated. A version at or below the one seen (same version, downgrade) shows nothing
-// and never lowers what was seen.
+// and never lowers what was seen. Started by the installer after an update (--whats-new), it is an update whatever the
+// settings say: they may have been deleted, or come from a Filee older than the first-run flag.
using Avalonia.Threading;
using Filee.App.Controls;
@@ -39,9 +40,10 @@ public sealed class WhatsNewService(UserDataStore store, WindowService windows,
internal readonly record struct Decision(SlideDeck? Show, Version? Remember);
/// <summary>The rules described at the top of this file, without side effects.</summary>
- internal static Decision Decide(string? seenSetting, bool firstRunCompleted, Version current, IEnumerable<SlideDeck> decks)
+ internal static Decision Decide(string? seenSetting, bool firstRunCompleted, Version current, IEnumerable<SlideDeck> decks,
+ bool updated = false)
{
- if (!firstRunCompleted)
+ if (!firstRunCompleted && !updated)
return new Decision(null, current);
var seen = SlideDeck.TryParseVersion(seenSetting);
if (seen is not null && current <= seen)
@@ -53,13 +55,14 @@ public sealed class WhatsNewService(UserDataStore store, WindowService windows,
/// <summary>
/// Called once at start-up, before the first run is marked complete. <paramref name="background"/> (started at
/// sign-in, or after an update without <c>--whats-new</c>) keeps the slides until the main window opens.
+ /// <paramref name="updated"/>: the installer started Filee after an update (<c>--whats-new</c>).
/// </summary>
- public void CheckAtStartup(bool background)
+ public void CheckAtStartup(bool background, bool updated = false)
{
Decision decision;
try
{
- decision = Decide(store.Settings.WhatsNewSeenVersion, store.Settings.FirstRunCompleted, CurrentVersion, Decks);
+ decision = Decide(store.Settings.WhatsNewSeenVersion, store.Settings.FirstRunCompleted, CurrentVersion, Decks, updated);
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
diff --git a/src/Filee.Setup/Installation/Installer.cs b/src/Filee.Setup/Installation/Installer.cs
index e30800ff..ea5aaf73 100644
--- a/src/Filee.Setup/Installation/Installer.cs
+++ b/src/Filee.Setup/Installation/Installer.cs
@@ -346,7 +346,8 @@ public sealed class Installer(SetupContext context, SetupPayload payload)
/// <summary>
/// A fresh install registers the top-level menu when ticked (removing an older registration first, which may point
- /// to another folder) and removes it when not; an update keeps what was chosen in Filee and refreshes it.
+ /// to another folder) and removes it when not; an update keeps what was chosen in Filee and refreshes it, unless
+ /// it is registered for this folder at this version already.
/// Returns Windows' error when registering failed.
/// </summary>
private string? UpdateExplorerMenu(string folder, InstallChoices choices, bool update, bool wasRegistered)
@@ -357,7 +358,11 @@ public sealed class Installer(SetupContext context, SetupPayload payload)
return null;
}
string? error = null;
- if (update ? wasRegistered : choices.Tasks.ContextMenu && choices.Tasks.ModernMenu)
+ if (update && wasRegistered && System.IsExplorerMenuCurrent(folder))
+ {
+ Log.Info("The Windows 11 Explorer menu package is registered already; Explorer loads the new menu by itself");
+ }
+ else if (update ? wasRegistered : choices.Tasks.ContextMenu && choices.Tasks.ModernMenu)
{
Log.Info("Registering the Windows 11 Explorer menu package");
error = System.RegisterExplorerMenu(folder, removeFirst: !update);
diff --git a/src/Filee.Setup/Platform/SetupSystem.cs b/src/Filee.Setup/Platform/SetupSystem.cs
index 23fb22d6..afe702f5 100644
--- a/src/Filee.Setup/Platform/SetupSystem.cs
+++ b/src/Filee.Setup/Platform/SetupSystem.cs
@@ -4,6 +4,7 @@
using System.Diagnostics;
using System.Runtime.Versioning;
+using Filee.Core.Platform;
using Filee.Platform.Windows;
namespace Filee.Setup.Platform;
@@ -18,6 +19,12 @@ public interface ISetupSystem
bool IsExplorerMenuRegistered();
+ /// <summary>
+ /// The package is registered for <paramref name="installFolder"/> at the version this build ships. Explorer then
+ /// picks up the new DLL by itself; registering it again fails while Explorer has the old one loaded (0x80073D02).
+ /// </summary>
+ bool IsExplorerMenuCurrent(string installFolder);
+
/// <summary>Registers the sparse package next to Filee.exe; returns why not, or null when it worked.</summary>
string? RegisterExplorerMenu(string installFolder, bool removeFirst);
@@ -59,6 +66,18 @@ public class WindowsSetupSystem(SetupLog log) : ISetupSystem
}
}
+ public virtual bool IsExplorerMenuCurrent(string installFolder)
+ {
+ try
+ {
+ return ExplorerMenuRegistration.GetState(installFolder) == ModernContextMenuState.On;
+ }
+ catch (Exception ex) when (ex is DllNotFoundException or EntryPointNotFoundException)
+ {
+ return false;
+ }
+ }
+
public virtual string? RegisterExplorerMenu(string installFolder, bool removeFirst)
{
if (removeFirst)
@@ -220,6 +239,8 @@ public sealed class SandboxSetupSystem(SetupLog log, string dataFolder) : Window
public override bool IsExplorerMenuRegistered() => false;
+ public override bool IsExplorerMenuCurrent(string installFolder) => false;
+
public override string? RegisterExplorerMenu(string installFolder, bool removeFirst) => "Not in a sandbox.";
public override void UnregisterExplorerMenu()
diff --git a/src/Filee.Setup/ViewModels/SetupViewModel.cs b/src/Filee.Setup/ViewModels/SetupViewModel.cs
index bb12a9fe..a37fee67 100644
--- a/src/Filee.Setup/ViewModels/SetupViewModel.cs
+++ b/src/Filee.Setup/ViewModels/SetupViewModel.cs
@@ -60,6 +60,8 @@ public sealed partial class SetupViewModel : ObservableObject
private readonly long _neededSpace;
private bool _languagePicked;
private InstallResult? _result;
+ private SlideDeck? _deck;
+ private bool _deckRead;
/// <param name="version">The Filee version Setup installs (or the uninstaller removes).</param>
/// <param name="initial">The choices from the command line and the defaults.</param>
@@ -97,8 +99,6 @@ public sealed partial class SetupViewModel : ObservableObject
UpdateEngineSelection();
};
}
- if (!uninstall)
- Deck = SlideDeck.Newest(SlideDeck.LoadAll("Filee.Setup"), seen: null, SlideDeck.TryParseVersion(version) ?? new Version(0, 0, 0));
_page = uninstall ? SetupPage.Uninstall : SetupPage.Welcome;
texts.LanguageChanged += (_, _) => RefreshTexts();
RefreshTexts();
@@ -120,9 +120,24 @@ public sealed partial class SetupViewModel : ObservableObject
/// <summary>
/// The newest "What's new" slides up to the version being installed (Assets/WhatsNew, shared with the app), shown
- /// while the files go in; null when there are none.
+ /// while the files go in; null when there are none. Read when first asked for: the model is made before Avalonia
+ /// starts, and its resources can't be read until then.
/// </summary>
- public SlideDeck? Deck { get; init; }
+ public SlideDeck? Deck
+ {
+ get
+ {
+ if (!_deckRead && !IsUninstall)
+ _deck = SlideDeck.Newest(SlideDeck.LoadAll("Filee.Setup"), seen: null, SlideDeck.TryParseVersion(Version) ?? new Version(0, 0, 0));
+ _deckRead = true;
+ return _deck;
+ }
+ init
+ {
+ _deck = value;
+ _deckRead = true;
+ }
+ }
/// <summary>Raised when the window should close (finished, cancelled).</summary>
public event EventHandler? CloseRequested;
diff --git a/tests/Filee.App.Tests/WhatsNewTests.cs b/tests/Filee.App.Tests/WhatsNewTests.cs
index 7fb4e3e3..39a1f8ee 100644
--- a/tests/Filee.App.Tests/WhatsNewTests.cs
+++ b/tests/Filee.App.Tests/WhatsNewTests.cs
@@ -117,6 +117,15 @@ public class WhatsNewTests
Assert.Equal(V2, decision.Remember);
}
+ [Fact]
+ public void The_installer_after_an_update_gets_the_slides_even_without_settings()
+ {
+ // The settings folder was deleted before updating: no first-run flag, but Setup says it was an update.
+ var decision = WhatsNewService.Decide(null, firstRunCompleted: false, V2, Decks, updated: true);
+ Assert.Equal(V2, decision.Show?.Version);
+ Assert.Equal(default, WhatsNewService.Decide("2.0.0", false, V2, Decks, updated: true));
+ }
+
[Fact]
public void An_update_from_before_the_slides_shows_this_versions_deck()
{
diff --git a/tests/Filee.Setup.Tests/InstallerTests.cs b/tests/Filee.Setup.Tests/InstallerTests.cs
index 5fe93add..bab81aee 100644
--- a/tests/Filee.Setup.Tests/InstallerTests.cs
+++ b/tests/Filee.Setup.Tests/InstallerTests.cs
@@ -87,6 +87,23 @@ public class InstallerTests
Assert.Equal("0x80073CF3 the package failed update", Assert.IsType<ExplorerMenuWarning>(Assert.Single(result.Warnings)).Error);
}
+ [Fact]
+ public void An_update_leaves_a_current_menu_registration_alone()
+ {
+ // Registering the same package again fails while Explorer has the menu loaded (0x80073D02).
+ using var bench = new SetupBench();
+ bench.System.ExplorerMenuSupported = true;
+ Assert.True(bench.Install().Succeeded);
+ bench.System.Calls.Clear();
+ bench.System.MenuCurrent = true;
+ bench.System.RegisterError = "0x80073D02 the package is in use";
+ var previous = PreviousInstall.Find(bench.Registry, InstallScope.Machine)!;
+ var result = bench.Install(bench.Choices(previous.CurrentTasks(bench.Registry, bench.System, bench.Paths)) with { Engines = [] }, previous);
+ Assert.True(result.Succeeded, result.Error?.ToString());
+ Assert.Empty(result.Warnings);
+ Assert.DoesNotContain(bench.System.Calls, c => c.Contains("register-menu", StringComparison.Ordinal));
+ }
+
[Fact]
public void Updating_over_filee_1_x_takes_the_inno_setup_installation_over()
{
diff --git a/tests/Filee.Setup.Tests/TestSupport.cs b/tests/Filee.Setup.Tests/TestSupport.cs
index abc2fd03..e600671d 100644
--- a/tests/Filee.Setup.Tests/TestSupport.cs
+++ b/tests/Filee.Setup.Tests/TestSupport.cs
@@ -58,6 +58,7 @@ public sealed class FakeSystem : ISetupSystem
{
public bool ExplorerMenuSupported { get; set; }
public bool MenuRegistered { get; set; }
+ public bool MenuCurrent { get; set; }
public string? RegisterError { get; set; }
public List<string> Calls { get; } = [];
public List<RunningProgram> Running { get; } = [];
@@ -66,6 +67,8 @@ public sealed class FakeSystem : ISetupSystem
public bool IsExplorerMenuRegistered() => MenuRegistered;
+ public bool IsExplorerMenuCurrent(string installFolder) => MenuRegistered && MenuCurrent;
+
public string? RegisterExplorerMenu(string installFolder, bool removeFirst)
{
Calls.Add($"register-menu {installFolder} {removeFirst}");