Programma di installazione per Windows scritto in casa, senza NSIS (C6, 2/4)
Decisione di Alberto del 18 novembre 2026: niente componenti esterni. Il programma di installazione è ora src/Febe.Installer, solo .NET: pubblicato per win-x64 autosufficiente, in un file solo, ridotto e compresso (circa 11 MB); lo stesso progetto, compilato per il sistema che costruisce, gli appende Febe.exe compresso con Brotli, la versione e un piè di pagina con SHA-256 (--impacchetta), lo ricontrolla (--verifica) e scrive lo zip portabile (--zip). Fa ciò che faceva lo script NSIS: installazione per utente in %LOCALAPPDATA%\Programs\Febe senza permessi di amministratore, collegamenti nel menu Start e (a scelta) sul desktop con ShellLink, voce in App installate sotto HKCU, controllo di WebView2, rifiuto con Febe aperto, aggiornamento che lascia i dati, «Disinstalla Febe.exe» che toglie solo il programma, i collegamenti, l'avvio con il computer e le librerie estratte, mai dati né libreria. Pagine con la finestra di dialogo di Windows; /S, /D= e /PROVA= per le prove. Tolti installer/febe.nsi, NSIS e zip dalla CI e dai documenti: costruisci.sh vuole solo il .NET SDK. Prove: pacchetto, riga di comando, installazione, aggiornamento e disinstallazione su un Windows finto (anche su Linux); su Windows il programma pubblicato davvero, installato e disinstallato senza domande in una cartella di prova, e la prima pagina aperta e annullata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c54d16946a
commit
7a54f1a460
37 files changed
+3275
-378
No files matched your search
@@ -0,0 +1,97 @@
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Febe.Installer.Windows;
|
||||
|
||||
/// <summary>The pages of the installer and of the uninstaller, as dialogs of Windows (texts: <see cref="Texts"/>).</summary>
|
||||
[SupportedOSPlatform("windows")]
|
||||
internal sealed class DialogInterface(Locations locations) : ISetupInterface
|
||||
{
|
||||
private const int Yes = 100;
|
||||
|
||||
private const int Cancel = TaskDialog.CancelId;
|
||||
|
||||
public bool? Welcome(string version, string? installedVersion, string installFolder)
|
||||
{
|
||||
var (button, desktop) = TaskDialog.Show(Texts.InstallTitle, new DialogPage(
|
||||
Texts.Welcome(version, installedVersion),
|
||||
Texts.WelcomeText(locations, installFolder, installedVersion),
|
||||
[(Yes, Texts.Install), (Cancel, Texts.Cancel)])
|
||||
{
|
||||
Verification = Texts.DesktopShortcut,
|
||||
VerificationChecked = true,
|
||||
});
|
||||
return button == Yes ? desktop : null;
|
||||
}
|
||||
|
||||
public bool RetryWhenFebeIsOpen(bool uninstalling)
|
||||
{
|
||||
var (button, _) = TaskDialog.Show(Title(uninstalling), new DialogPage(
|
||||
Texts.FebeOpen,
|
||||
Texts.FebeOpenText,
|
||||
[(Yes, Texts.Retry), (Cancel, Texts.Cancel)])
|
||||
{
|
||||
Icon = DialogIcon.Warning,
|
||||
});
|
||||
return button == Yes;
|
||||
}
|
||||
|
||||
public void RunWithProgress(string version, string installFolder, Action<Action<double>> work) =>
|
||||
TaskDialog.ShowProgress(Texts.InstallTitle, new DialogPage(
|
||||
Texts.Installing(version),
|
||||
Texts.InstallingText(installFolder),
|
||||
[(Yes, Texts.Wait)]), work);
|
||||
|
||||
public bool OfferWebView2Page()
|
||||
{
|
||||
var (button, _) = TaskDialog.Show(Texts.InstallTitle, new DialogPage(
|
||||
Texts.WebView2Missing,
|
||||
Texts.WebView2MissingText,
|
||||
[(Yes, Texts.OpenPage), (Cancel, Texts.NotNow)])
|
||||
{
|
||||
Icon = DialogIcon.Information,
|
||||
});
|
||||
return button == Yes;
|
||||
}
|
||||
|
||||
public bool Installed()
|
||||
{
|
||||
var (_, run) = TaskDialog.Show(Texts.InstallTitle, new DialogPage(
|
||||
Texts.Installed,
|
||||
Texts.InstalledText,
|
||||
[(Yes, Texts.Finish)])
|
||||
{
|
||||
Verification = Texts.RunFebe,
|
||||
VerificationChecked = true,
|
||||
});
|
||||
return run;
|
||||
}
|
||||
|
||||
public bool ConfirmUninstall()
|
||||
{
|
||||
var (button, _) = TaskDialog.Show(Texts.UninstallTitle, new DialogPage(
|
||||
Texts.ConfirmUninstall,
|
||||
Texts.ConfirmUninstallText,
|
||||
[(Yes, Texts.Uninstall), (Cancel, Texts.Cancel)]));
|
||||
return button == Yes;
|
||||
}
|
||||
|
||||
public void Uninstalled(string dataFolder, string library) =>
|
||||
TaskDialog.Show(Texts.UninstallTitle, new DialogPage(
|
||||
Texts.Uninstalled,
|
||||
Texts.UninstalledText(dataFolder, library),
|
||||
[(Yes, Texts.Finish)])
|
||||
{
|
||||
Icon = DialogIcon.Information,
|
||||
});
|
||||
|
||||
public void Failed(bool uninstalling, string message) =>
|
||||
TaskDialog.Show(Title(uninstalling), new DialogPage(
|
||||
uninstalling ? Texts.UninstallFailed : Texts.InstallFailed,
|
||||
message,
|
||||
[(Yes, Texts.Finish)])
|
||||
{
|
||||
Icon = DialogIcon.Error,
|
||||
});
|
||||
|
||||
private static string Title(bool uninstalling) => uninstalling ? Texts.UninstallTitle : Texts.InstallTitle;
|
||||
}
|
||||
Reference in new issue
Block a user