LANCommander/LANCommander.Launcher/UI/Components/ValidateFilesDialog.razor
Pat Hartl 5a32bbf890 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

79 lines
2.7 KiB
Text

@using LANCommander.SDK.Models
@inherits FeedbackComponent<Data.Models.Game>
@inject SaveService SaveService
@inject SDK.Client Client
@inject IMessageService MessageService
@inject LocalizationService LocalizationService
<Table DataSource="Conflicts" Resizable Size="TableSize.Small" RowKey="c => c.FullName" @bind-SelectedRows="Selected" Loading="Loading">
<Selection Type="SelectionType.Checkbox" />
<PropertyColumn Property="c => c.FullName" Title="@LocalizationService.GetString("Name")" />
<Column TData="string" Title="@LocalizationService.GetString("Created")">
@context.LocalFileInfo?.CreationTime
</Column>
<Column TData="string" Title="@LocalizationService.GetString("Modified")">
@context.LocalFileInfo?.LastWriteTime
</Column>
<Column TData="string" Title="@LocalizationService.GetString("LocalSize")">
@if (context.LocalFileInfo?.Length > 0)
{
<ByteSize Value="context.LocalFileInfo.Length" />
}
</Column>
<PropertyColumn Property="c => c.Length" Title="@LocalizationService.GetString("OriginalSize")">
@if (context.Length > 0)
{
<ByteSize Value="context.Length" />
}
</PropertyColumn>
<Column TData="string" Title="@LocalizationService.GetString("SourceGame")">
@{
GameTitleMap.TryGetValue(context.GameId.GetValueOrDefault(Guid.Empty), out var title);
}
@(title ?? Options.Title)
</Column>
</Table>
@code {
IEnumerable<ArchiveValidationConflict> Conflicts = new List<ArchiveValidationConflict>();
IEnumerable<ArchiveValidationConflict> Selected = new List<ArchiveValidationConflict>();
IDictionary<Guid, string> GameTitleMap = new Dictionary<Guid, string>();
bool Loading = true;
protected override async Task OnInitializedAsync()
{
await LoadData();
}
async Task Close()
{
await CloseFeedbackAsync();
}
async Task LoadData()
{
var localAddons = Options.DependentGames?.Where(g => g.Installed).ToArray() ?? [];
GameTitleMap = localAddons.ToDictionary(x => x.Id, x => x.Title);
Conflicts = await Client.Games.ValidateFilesAsync(Options.InstallDirectory, Options.Id);
Loading = false;
}
public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args)
{
Loading = true;
StateHasChanged();
await Task.Yield();
await Client.Games.DownloadFilesAsync(Options.InstallDirectory, Selected.Select(e => (e.GameId ?? Options.Id, e.FullName)).ToArray());
Loading = false;
StateHasChanged();
await Task.Yield();
await base.CloseFeedbackAsync();
}
}