- Move all Launcher components to LANCommander.Launcher.UI namespace - Move all SCSS files next to components (when possible) - Refactor styles that control overflow of content into titlebar to MainWindow only - Remove use in launcher UI of SDK.Client
78 lines
2.6 KiB
Text
78 lines
2.6 KiB
Text
@using LANCommander.SDK.Models
|
|
@namespace LANCommander.Launcher.UI
|
|
@inherits FeedbackComponent<Data.Models.Game>
|
|
@inject GameClient GameClient
|
|
@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 GameClient.ValidateFilesAsync(Options.InstallDirectory, Options.Id);
|
|
|
|
Loading = false;
|
|
}
|
|
|
|
public override async Task OnFeedbackOkAsync(ModalClosingEventArgs args)
|
|
{
|
|
Loading = true;
|
|
StateHasChanged();
|
|
await Task.Yield();
|
|
|
|
await GameClient.DownloadFilesAsync(Options.InstallDirectory, Selected.Select(e => (e.GameId ?? Options.Id, e.FullName)).ToArray());
|
|
|
|
Loading = false;
|
|
StateHasChanged();
|
|
await Task.Yield();
|
|
|
|
await base.CloseFeedbackAsync();
|
|
}
|
|
}
|