better-genshin-impact/Build/MicaSetup/Program.cs

80 lines
3.1 KiB
C#

using MicaSetup.Design.Controls;
using MicaSetup.Services;
using MicaSetup.Views;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: Guid("00000000-0000-0000-0000-000000000000")]
[assembly: AssemblyTitle("BetterGI Setup")]
[assembly: AssemblyProduct("BetterGI")]
[assembly: AssemblyDescription("BetterGI Setup")]
[assembly: AssemblyCompany("Lemutec")]
[assembly: AssemblyCopyright("Under GPL-3.0 license. Copyright (c) better-genshin-impact Contributors.")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
namespace MicaSetup;
internal class Program
{
[STAThread]
internal static void Main()
{
Hosting.CreateBuilder()
.UseLogger()
.UseSingleInstance("BetterGI_MicaSetup")
.UseTempPathFork()
.UseElevated()
.UseDpiAware()
.UseOptions(option =>
{
option.IsCreateDesktopShortcut = true;
option.IsCreateUninst = true;
option.IsCreateStartMenu = true;
option.IsCreateQuickLaunch = false;
option.IsCreateRegistryKeys = true;
option.IsCreateAsAutoRun = false;
option.IsCustomizeVisiableAutoRun = false;
option.AutoRunLaunchCommand = "-autostart";
option.UseFolderPickerPreferClassic = false;
option.UseInstallPathPreferX86 = false;
option.IsUseRegistryPreferX86 = null!;
option.IsAllowFullFolderSecurity = true;
option.IsAllowFirewall = true;
option.IsRefreshExplorer = true;
option.IsInstallCertificate = false;
option.OverlayInstallRemoveExt = "exe,dll,pdb";
option.UnpackingPassword = null!;
option.ExeName = @"BetterGI.exe";
option.KeyName = "BetterGI";
option.DisplayName = "BetterGI";
option.DisplayIcon = @"BetterGI.exe";
option.DisplayVersion = "0.0.0.0";
option.Publisher = "babalae";
option.AppName = "BetterGI";
option.SetupName = $"BetterGI {Mui("Setup")}";
})
.UseServices(service =>
{
service.AddSingleton<IMuiLanguageService, MuiLanguageService>();
service.AddScoped<IDotNetVersionService, DotNetVersionService>();
service.AddScoped<IExplorerService, ExplorerService>();
})
.CreateApp()
.UseMuiLanguage()
.UseTheme(WindowsTheme.Auto)
.UsePages(page =>
{
page.Add(nameof(MainPage), typeof(MainPage));
page.Add(nameof(InstallPage), typeof(InstallPage));
page.Add(nameof(FinishPage), typeof(FinishPage));
})
.UseDispatcherUnhandledExceptionCatched()
.UseDomainUnhandledExceptionCatched()
.UseUnobservedTaskExceptionCatched()
.RunApp();
}
}