The installer had no screenshot mode, so CI could not review its stages. Titano.Setup.exe --capture <dir> builds a small sample installer in a temporary folder and renders install options, programs running, installing, installed, failed and uninstall with the "Remove my data" plan, in the dark and light themes and in Arabic (mirrored). Nothing is installed, removed or registered. Also: uploader smoke tests (names, focusable rows, no premature errors, right-to-left islands), and watch chips cap the path itself because the button template measures content without a width limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
63 lines
2.2 KiB
C#
63 lines
2.2 KiB
C#
using System.Globalization;
|
|
using Titano.Core.Diagnostics;
|
|
using Titano.Core.Localization;
|
|
using Titano.Setup.Cli;
|
|
using Titano.Setup.Engine;
|
|
|
|
namespace Titano.Setup;
|
|
|
|
/// <summary>
|
|
/// Entry point. Silent mode and the uninstaller cleanup helper run without WPF; the interactive window is the
|
|
/// <see cref="App"/>. The return value is the process exit code (<see cref="SetupExitCode"/>).
|
|
/// </summary>
|
|
internal static class Program
|
|
{
|
|
[STAThread]
|
|
public static int Main(string[] args)
|
|
{
|
|
using var log = new FileLogSink(SetupPaths.LogDirectory, "setup");
|
|
Log.SetSink(log);
|
|
Log.Info("setup", $"Titano.Setup {typeof(Program).Assembly.GetName().Version} {string.Join(' ', args)}");
|
|
// The screenshot mode of every Titano program (CI); it builds its own sample installer.
|
|
if (args is ["--capture", var captureDirectory]) return Views.SetupCapture.Run(captureDirectory);
|
|
|
|
SetupArguments arguments;
|
|
try
|
|
{
|
|
arguments = SetupArguments.Parse(args);
|
|
}
|
|
catch (ArgumentException ex)
|
|
{
|
|
Log.Error("setup", ex.Message);
|
|
return (int)SetupExitCode.InvalidArguments;
|
|
}
|
|
ApplyLanguage(arguments.Language);
|
|
|
|
if (arguments.CleanupTarget is { } uninstaller) return (int)SelfCleanup.Run(uninstaller, arguments.WaitProcessId);
|
|
if (arguments.Silent) return (int)SilentSetup.RunAsync(arguments).GetAwaiter().GetResult();
|
|
|
|
return new App(arguments).Run();
|
|
}
|
|
|
|
/// <summary>Sets the UI language: the requested code, else the best match for the Windows display language.</summary>
|
|
public static void ApplyLanguage(string? code)
|
|
{
|
|
var requested = CultureInfo.CurrentUICulture;
|
|
if (code is not null)
|
|
{
|
|
try
|
|
{
|
|
requested = CultureInfo.GetCultureInfo(code);
|
|
}
|
|
catch (CultureNotFoundException)
|
|
{
|
|
Log.Warning("setup", $"Unknown language '{code}'");
|
|
}
|
|
}
|
|
var culture = Languages.BestMatch(requested);
|
|
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
|
CultureInfo.CurrentUICulture = culture;
|
|
Loc.SetCulture(culture);
|
|
}
|
|
}
|