2025-11-07 19:09:43 -06:00
|
|
|
@using LANCommander.Launcher.Models
|
2025-10-05 17:13:47 -05:00
|
|
|
@using LANCommander.SDK.Services
|
2024-06-05 01:21:31 -05:00
|
|
|
@using Photino.Blazor.CustomWindow.Components
|
|
|
|
|
@inherits LayoutComponentBase
|
|
|
|
|
@inject ImportService ImportService
|
|
|
|
|
@inject ProfileService ProfileService
|
2025-01-18 20:25:39 -06:00
|
|
|
@inject AuthenticationService AuthenticationService
|
2024-06-05 01:21:31 -05:00
|
|
|
@inject IMessageService MessageService
|
|
|
|
|
@inject NavigationManager NavigationManager
|
2024-06-05 23:37:16 -05:00
|
|
|
@inject ModalService ModalService
|
2025-09-29 19:49:09 -05:00
|
|
|
@inject LANCommander.SDK.Client Client
|
2024-06-11 02:05:15 -05:00
|
|
|
@inject IJSRuntime JS
|
2025-02-06 20:54:03 -06:00
|
|
|
@inject ImportManagerService ImportManagerService
|
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
|
2025-10-05 17:13:47 -05:00
|
|
|
@inject IConnectionClient ConnectionClient
|
2024-06-05 01:21:31 -05:00
|
|
|
|
2025-01-18 20:25:39 -06:00
|
|
|
<CustomWindow HeaderHeight="37">
|
|
|
|
|
<HeaderExtraControlsLayout>
|
|
|
|
|
<Space Direction="SpaceDirection.Horizontal">
|
2025-06-12 04:04:04 +02:00
|
|
|
<AuthenticatedView NoAutoValidate="true">
|
2025-01-20 12:10:30 -06:00
|
|
|
<Authenticated>
|
2025-01-18 20:25:39 -06:00
|
|
|
<SpaceItem>
|
2025-06-10 00:17:17 +02:00
|
|
|
@if (ImportStatus.IsActive)
|
2025-02-06 20:54:03 -06:00
|
|
|
{
|
|
|
|
|
<Popover Placement="Placement.BottomRight" IsButton Trigger="new[] { Trigger.Hover }">
|
|
|
|
|
<ChildContent>
|
2025-06-10 00:17:17 +02:00
|
|
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Sync" Loading="true"/>
|
2025-02-06 20:54:03 -06:00
|
|
|
</ChildContent>
|
|
|
|
|
<ContentTemplate>
|
|
|
|
|
<ImportProgressDisplay
|
2025-06-10 00:17:17 +02:00
|
|
|
Index="@ImportStatus.Index"
|
|
|
|
|
Total="@ImportStatus.Total"
|
2025-02-06 20:54:03 -06:00
|
|
|
CurrentItem="@(_importProgress?.CurrentItem)"
|
|
|
|
|
/>
|
|
|
|
|
</ContentTemplate>
|
|
|
|
|
</Popover>
|
|
|
|
|
}
|
2025-10-05 17:52:37 -05:00
|
|
|
else
|
2025-02-06 20:54:03 -06:00
|
|
|
{
|
2025-10-05 17:52:37 -05:00
|
|
|
if (ConnectionClient.IsOfflineMode())
|
|
|
|
|
{
|
|
|
|
|
<Tooltip Title="@LocalizationService.GetString("ReconnectToServer")" MouseEnterDelay="0.5">
|
|
|
|
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.CloudSync" OnClick="Connect" Loading="@Connecting" Danger/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
else if (ConnectionClient.IsConnected())
|
|
|
|
|
{
|
|
|
|
|
<Tooltip Title="@LocalizationService.GetString("ReimportLibrary")" MouseEnterDelay="0.5">
|
|
|
|
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Sync" OnClick="@ImportHandler.Import"/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
2025-02-06 20:54:03 -06:00
|
|
|
}
|
2025-01-18 20:25:39 -06:00
|
|
|
</SpaceItem>
|
2025-01-20 12:10:30 -06:00
|
|
|
|
|
|
|
|
<SpaceItem>
|
|
|
|
|
<ProfileButton/>
|
|
|
|
|
</SpaceItem>
|
|
|
|
|
</Authenticated>
|
2025-06-12 04:04:04 +02:00
|
|
|
|
2025-01-20 12:10:30 -06:00
|
|
|
<NotAuthenticated>
|
2025-01-18 20:25:39 -06:00
|
|
|
<SpaceItem>
|
|
|
|
|
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.CloudSync" OnClick="Connect" Loading="@Connecting" Danger/>
|
|
|
|
|
</SpaceItem>
|
2025-01-20 12:10:30 -06:00
|
|
|
</NotAuthenticated>
|
|
|
|
|
</AuthenticatedView>
|
2025-01-18 20:25:39 -06:00
|
|
|
</Space>
|
|
|
|
|
</HeaderExtraControlsLayout>
|
|
|
|
|
<WindowContent>
|
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
|
|
|
<ErrorHandler Title="@LocalizationService.GetString("LauncherCrashed")">
|
2025-01-21 20:42:39 -06:00
|
|
|
<Body>
|
2025-11-21 18:20:01 -06:00
|
|
|
<Layout>
|
|
|
|
|
@Body
|
|
|
|
|
</Layout>
|
|
|
|
|
|
|
|
|
|
<div class="logo">
|
|
|
|
|
<img src="assets/logo-cut.svg" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<LANCommander.Launcher.UI.Components.Footer />
|
2025-01-20 12:10:30 -06:00
|
|
|
|
2025-11-26 22:38:04 -06:00
|
|
|
<PowerShellConsole />
|
|
|
|
|
|
2025-11-07 20:19:13 -06:00
|
|
|
<ImportHandler @ref="ImportHandler" Progress="OnImportProcess"/>
|
2025-01-21 20:42:39 -06:00
|
|
|
<UpdateChecker/>
|
|
|
|
|
<AntContainer/>
|
2025-11-03 23:24:47 -06:00
|
|
|
<KeepAliveContainer/>
|
2025-01-21 20:42:39 -06:00
|
|
|
</Body>
|
2025-06-10 00:17:17 +02:00
|
|
|
|
2025-01-21 20:42:39 -06:00
|
|
|
<Extra>
|
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 Type="ButtonType.Primary" OnClick="@(() => NavigationManager.NavigateTo("/", true))">@LocalizationService.GetString("ViewLibrary")</Button>
|
2025-01-21 20:42:39 -06:00
|
|
|
</Extra>
|
2025-01-20 12:10:30 -06:00
|
|
|
</ErrorHandler>
|
2025-01-18 20:25:39 -06:00
|
|
|
</WindowContent>
|
|
|
|
|
</CustomWindow>
|
2024-06-05 01:21:31 -05:00
|
|
|
|
|
|
|
|
@code {
|
2025-01-20 12:10:30 -06:00
|
|
|
public bool Importing;
|
|
|
|
|
public bool Connecting;
|
2025-01-18 20:25:39 -06:00
|
|
|
|
2024-06-11 02:05:15 -05:00
|
|
|
public IMessageService Messages { get; set; }
|
|
|
|
|
|
2025-06-10 00:17:17 +02:00
|
|
|
ImportHandler ImportHandler;
|
|
|
|
|
ImportHandler.ImportProgressEventArgs ImportStatus = new();
|
|
|
|
|
private ImportProgress _importProgress => ImportService.Progress;
|
|
|
|
|
|
2025-01-14 19:03:50 -06:00
|
|
|
string RandomQuip = "";
|
2025-06-10 00:17:17 +02: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
|
|
|
string[] _crashQuips;
|
2025-01-14 19:03:50 -06:00
|
|
|
|
2024-06-05 01:21:31 -05:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
ConnectionClient.OnOfflineModeEnabled += OnOfflineModeChanged;
|
|
|
|
|
ConnectionClient.OnConnect += OnConnect;
|
2025-02-16 16:46:31 -06:00
|
|
|
|
2025-11-19 00:36:03 -06:00
|
|
|
if (await Client.Authentication.ValidateTokenAsync())
|
2025-02-16 16:46:31 -06:00
|
|
|
{
|
|
|
|
|
await AuthenticationService.Login();
|
2025-06-10 00:17:17 +02:00
|
|
|
|
2025-06-11 22:02:41 +02:00
|
|
|
await ImportManagerService.RequestImport();
|
2025-02-16 16:46:31 -06:00
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
_crashQuips = new[]
|
|
|
|
|
{
|
|
|
|
|
LocalizationService.GetString("CrashQuip_YouDied"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_Snake"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_Wasted"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_MajorFracture"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_PastIsGapingHole"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_TownCenterDestroyed"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_ForcesUnderAttack"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_LostLead"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_TerroristsWin"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_WarNeverChanges"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_DiedOfDysentery"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_FailedToRestoreBooks"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_PlayerSplattered"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_BlameISP"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_BabaNoMore"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_GuestsLost"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_DarknessOvercome"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_GordonFreemanTerminated"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_MissionFailedSpotted"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_CriticalDamageEject"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_MinionsUnhappy"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_EmpireTriumphed"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_QuestEndedFailure"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_EatenByGrue"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_NoMessWithLoWang"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_SamKilled"),
|
|
|
|
|
LocalizationService.GetString("CrashQuip_AlienBastardsPay")
|
|
|
|
|
};
|
2025-06-10 00:17:17 +02: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
|
|
|
var randIndex = new Random().Next(0, _crashQuips.Length - 1);
|
|
|
|
|
RandomQuip = _crashQuips[randIndex];
|
2024-07-13 12:55:42 -05:00
|
|
|
}
|
|
|
|
|
|
2025-10-05 17:13:47 -05:00
|
|
|
private async void OnConnect(object? sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
await ImportManagerService.RequestImport();
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-06 20:54:03 -06:00
|
|
|
public void Dispose()
|
2024-07-13 12:55:42 -05:00
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
if (ConnectionClient != null)
|
|
|
|
|
ConnectionClient.OnOfflineModeEnabled -= OnOfflineModeChanged;
|
2025-01-12 02:54:41 -06:00
|
|
|
}
|
|
|
|
|
|
2025-11-21 18:20:01 -06:00
|
|
|
async void OnOfflineModeChanged(object? sender, EventArgs eventArgs)
|
2025-01-18 20:25:39 -06:00
|
|
|
{
|
2025-11-21 18:20:01 -06:00
|
|
|
await InvokeAsync(StateHasChanged);
|
2025-01-18 20:25:39 -06:00
|
|
|
}
|
|
|
|
|
|
2025-06-10 00:17:17 +02:00
|
|
|
async void OnImportProcess(ImportHandler.ImportProgressEventArgs importProgress)
|
|
|
|
|
{
|
|
|
|
|
ImportStatus = importProgress;
|
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-14 19:03:50 -06:00
|
|
|
async Task CopyError(Exception ex)
|
|
|
|
|
{
|
2025-01-15 00:32:42 -06:00
|
|
|
await JS.InvokeVoidAsync("navigator.clipboard.writeText", ex.Message + "\n" + ex.StackTrace);
|
2025-01-14 19:03:50 -06: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.Info(LocalizationService.GetString("ErrorCopiedToClipboard"));
|
2025-01-14 19:03:50 -06:00
|
|
|
}
|
|
|
|
|
|
2024-07-15 17:26:24 -05:00
|
|
|
async Task Connect()
|
|
|
|
|
{
|
|
|
|
|
Connecting = true;
|
|
|
|
|
|
2025-10-05 17:13:47 -05:00
|
|
|
if (await ConnectionClient.ConnectAsync())
|
2024-07-15 17:26:24 -05:00
|
|
|
{
|
2025-02-16 16:46:31 -06:00
|
|
|
await ProfileService.DownloadProfileInfoAsync();
|
2025-10-05 17:13:47 -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("BackOnline"));
|
2025-06-10 00:17:17 +02:00
|
|
|
|
2025-01-18 20:25:39 -06:00
|
|
|
await InvokeAsync(StateHasChanged);
|
2024-07-15 17:26:24 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
await ModalService.ConfirmAsync(new ConfirmOptions()
|
2024-07-15 17:26:24 -05:00
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
Title = LocalizationService.GetString("CouldNotReconnect"),
|
|
|
|
|
Icon = @<Icon Type="@IconType.Outline.ExclamationCircle"></Icon>,
|
|
|
|
|
Content = LocalizationService.GetString("CouldNotReconnectMessage"),
|
|
|
|
|
OkText = LocalizationService.GetString("Logout"),
|
|
|
|
|
CancelText = LocalizationService.GetString("StayOffline"),
|
|
|
|
|
Centered = true,
|
|
|
|
|
OnOk = async (e) =>
|
2024-07-15 17:26:24 -05:00
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
await Logout();
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-07-15 17:26:24 -05:00
|
|
|
}
|
2025-10-05 17:13:47 -05:00
|
|
|
|
2024-07-15 17:26:24 -05:00
|
|
|
Connecting = false;
|
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-06 17:11:35 -05:00
|
|
|
async Task Logout()
|
|
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
await ConnectionClient.DisconnectAsync();
|
2025-01-18 20:25:39 -06:00
|
|
|
await AuthenticationService.Logout();
|
2025-06-10 00:17:17 +02:00
|
|
|
|
2024-10-06 17:11:35 -05:00
|
|
|
NavigationManager.NavigateTo("/Authenticate");
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-06 20:54:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.import-progress {
|
|
|
|
|
width: 300px; /* Fixed width */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.import-progress .downloader-current-upper-status {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
max-width: 100%;
|
2024-06-05 01:21:31 -05:00
|
|
|
}
|
2025-02-06 20:54:03 -06:00
|
|
|
</style>
|