2024-07-07 20:28:03 -05:00
|
|
|
@page "/Settings"
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@using System.Globalization
|
2024-08-04 17:53:19 -05:00
|
|
|
@using LANCommander.Launcher.Models
|
2024-07-07 20:28:03 -05:00
|
|
|
@inject NavigationManager NavigationManager
|
2024-07-25 19:21:52 -05:00
|
|
|
@inject UpdateService UpdateService
|
2024-08-16 18:36:17 -05:00
|
|
|
@inject SDK.Client Client
|
2024-07-07 20:28:03 -05:00
|
|
|
@inject IMessageService MessageService
|
|
|
|
|
@inject ILogger<Index> Logger
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@inject LocalizationService LocalizationService
|
2024-07-07 20:28:03 -05:00
|
|
|
|
2024-08-01 00:30:54 -05:00
|
|
|
<div style="flex-grow: 1">
|
|
|
|
|
<PageHeader Title="Settings" OnBack="@(() => { NavigationManager.NavigateTo("/"); })" Style="padding-top: 48px">
|
|
|
|
|
<PageHeaderExtra>
|
2025-02-16 00:32:02 -06:00
|
|
|
<Flex Gap="FlexGap.Small" Justify="FlexJustify.End">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Button OnClick="CheckForUpdates">@LocalizationService.GetString("CheckForUpdates")</Button>
|
|
|
|
|
<Button OnClick="Save" Type="ButtonType.Primary">@LocalizationService.GetString("Save")</Button>
|
2025-02-16 00:32:02 -06:00
|
|
|
</Flex>
|
2024-08-01 00:30:54 -05:00
|
|
|
</PageHeaderExtra>
|
|
|
|
|
</PageHeader>
|
2024-07-07 20:28:03 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Form Model="_settings" Layout="@FormLayout.Vertical" Style="padding: 0 24px">
|
|
|
|
|
<Divider Orientation="DividerOrientation.Left" Plain>@LocalizationService.GetString("Games")</Divider>
|
|
|
|
|
<FormItem Label="@LocalizationService.GetString("StoragePaths")">
|
2025-02-16 00:32:02 -06:00
|
|
|
<Flex Direction="FlexDirection.Vertical" Gap="FlexGap.Middle">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@foreach (var installDirectory in _installDirectories)
|
2024-09-12 19:09:13 -05:00
|
|
|
{
|
2025-02-16 00:32:02 -06:00
|
|
|
<Flex Gap="FlexGap.Small">
|
|
|
|
|
<Input @bind-Value="installDirectory.Path"/>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Button OnClick="() => RemoveInstallDirectory(installDirectory)" Type="@ButtonType.Text" Danger Icon="@IconType.Outline.Close" Disabled="_installDirectories.Count == 1"/>
|
2025-02-16 00:32:02 -06:00
|
|
|
</Flex>
|
2024-09-12 19:09:13 -05:00
|
|
|
}
|
2025-02-16 00:32:02 -06:00
|
|
|
<Flex Justify="FlexJustify.End">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Button OnClick="AddInstallDirectory" Type="ButtonType.Primary">@LocalizationService.GetString("AddPath")</Button>
|
2025-02-16 00:32:02 -06:00
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
2024-08-01 00:30:54 -05:00
|
|
|
</FormItem>
|
2024-07-07 20:28:03 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Divider Orientation="DividerOrientation.Left" Plain>@LocalizationService.GetString("Media")</Divider>
|
|
|
|
|
<FormItem Label="@LocalizationService.GetString("StoragePath")">
|
2024-08-01 00:30:54 -05:00
|
|
|
<Input @bind-Value="@context.Media.StoragePath" />
|
|
|
|
|
</FormItem>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
|
|
|
|
|
<Divider Orientation="DividerOrientation.Left" Plain>@LocalizationService.GetString("UI")</Divider>
|
|
|
|
|
<FormItem Label="@LocalizationService.GetString("Language")">
|
|
|
|
|
<Select @bind-Value="@context.Culture" TItem="string" TItemValue="string" DataSource="_supportedCultures">
|
|
|
|
|
<LabelTemplate Context="Value">@(CultureInfo.GetCultureInfo(Value).NativeName)</LabelTemplate>
|
|
|
|
|
<ItemTemplate Context="Value">@(CultureInfo.GetCultureInfo(Value).NativeName)</ItemTemplate>
|
|
|
|
|
</Select>
|
|
|
|
|
</FormItem>
|
2024-07-07 20:28:03 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Divider Orientation="DividerOrientation.Left" Plain>@LocalizationService.GetString("Debug")</Divider>
|
|
|
|
|
<FormItem Label="@LocalizationService.GetString("EnableScriptDebugging")">
|
2024-08-01 00:30:54 -05:00
|
|
|
<Switch @bind-Checked="@context.Debug.EnableScriptDebugging" />
|
|
|
|
|
</FormItem>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<FormItem Label="@LocalizationService.GetString("LoggingPath")">
|
2024-08-01 00:30:54 -05:00
|
|
|
<Input @bind-Value="@context.Debug.LoggingPath" />
|
|
|
|
|
</FormItem>
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<FormItem Label="@LocalizationService.GetString("LoggingLevel")">
|
2024-08-01 00:30:54 -05:00
|
|
|
<Select @bind-Value="@context.Debug.LoggingLevel" TItem="LogLevel" TItemValue="LogLevel" DataSource="Enum.GetValues<LogLevel>()">
|
|
|
|
|
<LabelTemplate Context="Value">@Value.GetDisplayName()</LabelTemplate>
|
|
|
|
|
<ItemTemplate Context="Value">@Value.GetDisplayName()</ItemTemplate>
|
|
|
|
|
</Select>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-02-16 00:32:02 -06:00
|
|
|
<Flex Justify="FlexJustify.Center" Style="padding: 12px;">
|
|
|
|
|
LANCommander Launcher v@(UpdateService.GetCurrentVersion().ToString())
|
|
|
|
|
</Flex>
|
2024-07-07 20:28:03 -05:00
|
|
|
|
|
|
|
|
@code {
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Settings _settings;
|
2024-07-07 20:28:03 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
List<InstallDirectory> _installDirectories = new();
|
|
|
|
|
|
|
|
|
|
string[] _supportedCultures = new[]
|
|
|
|
|
{
|
|
|
|
|
"en-US",
|
|
|
|
|
"de",
|
|
|
|
|
"es",
|
|
|
|
|
"fr",
|
|
|
|
|
"it",
|
|
|
|
|
"pt-BR",
|
|
|
|
|
"nl",
|
|
|
|
|
"ja",
|
|
|
|
|
"zh",
|
|
|
|
|
"ko",
|
|
|
|
|
"uk"
|
|
|
|
|
};
|
2024-09-12 19:09:13 -05:00
|
|
|
|
|
|
|
|
internal class InstallDirectory
|
|
|
|
|
{
|
|
|
|
|
internal Guid Id { get; set; }
|
|
|
|
|
internal string Path { get; set; }
|
|
|
|
|
|
|
|
|
|
public InstallDirectory(string path)
|
|
|
|
|
{
|
|
|
|
|
Id = Guid.NewGuid();
|
|
|
|
|
Path = path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-07 20:28:03 -05:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
_settings = SettingService.GetSettings();
|
2024-09-12 19:09:13 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
foreach (var installDirectory in _settings.Games.InstallDirectories)
|
2024-09-12 19:09:13 -05:00
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
_installDirectories.Add(new InstallDirectory(installDirectory));
|
2024-09-12 19:09:13 -05:00
|
|
|
}
|
2024-07-07 20:28:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Save()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
_settings.Games.InstallDirectories = _installDirectories.Where(d => !String.IsNullOrWhiteSpace(d.Path)).Select(d => d.Path).ToArray();
|
2024-09-12 19:09:13 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
SettingService.SaveSettings(_settings);
|
2024-07-07 20:28:03 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Client.DefaultInstallDirectory = _settings.Games.InstallDirectories.First();
|
|
|
|
|
Client.Scripts.Debug = _settings.Debug.EnableScriptDebugging;
|
2024-08-16 18:36:17 -05:00
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
MessageService.Success(LocalizationService.GetString("SettingsSaved"));
|
2024-07-07 20:28:03 -05:00
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
MessageService.Error(LocalizationService.GetString("AnUnknownErrorOccurred"));
|
2024-07-07 20:28:03 -05:00
|
|
|
Logger.LogError(ex, "An unknown error occurred.");
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-25 19:21:52 -05:00
|
|
|
|
|
|
|
|
async Task CheckForUpdates()
|
|
|
|
|
{
|
2024-07-26 00:54:39 -05:00
|
|
|
var updateVersion = await UpdateService.CheckForUpdateAsync();
|
|
|
|
|
|
2025-08-12 19:04:19 +02:00
|
|
|
Logger.LogDebug("Checked for update: {UpdateVersion}", updateVersion.Version);
|
|
|
|
|
|
|
|
|
|
if (updateVersion.Version == null)
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
MessageService.Success(LocalizationService.GetString("YouAreOnLatestVersion"));
|
2024-07-25 19:21:52 -05:00
|
|
|
}
|
2024-09-12 19:09:13 -05:00
|
|
|
|
|
|
|
|
async Task AddInstallDirectory()
|
|
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
_installDirectories.Add(new InstallDirectory(""));
|
2024-09-12 19:09:13 -05:00
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task RemoveInstallDirectory(InstallDirectory installDirectory)
|
|
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
_installDirectories.Remove(installDirectory);
|
2024-09-12 19:09:13 -05:00
|
|
|
}
|
2024-07-07 20:28:03 -05:00
|
|
|
}
|