LANCommander/LANCommander.Launcher/UI/Components/ValidateFilesDialog.razor

68 lines
1.9 KiB
Text
Raw Normal View History

2025-02-04 18:39:29 -06:00
@using LANCommander.SDK.Models
@inherits FeedbackComponent<Data.Models.Game>
@inject SaveService SaveService
@inject SDK.Client Client
@inject IMessageService MessageService
<Table DataSource="Conflicts" Resizable Size="TableSize.Small" RowKey="c => c.FullName" @bind-SelectedRows="Selected" Loading="Loading">
2024-12-31 18:21:41 -06:00
<Selection Type="SelectionType.Checkbox" />
<PropertyColumn Property="c => c.FullName" Title="Name" />
<Column TData="string" Title="Created">
@context.LocalFileInfo?.CreationTime
</Column>
<Column TData="string" Title="Modified">
@context.LocalFileInfo?.LastWriteTime
</Column>
<Column TData="string" Title="Local Size">
@if (context.LocalFileInfo?.Length > 0)
{
2025-01-29 23:02:59 -06:00
<ByteSize Value="context.LocalFileInfo.Length" />
}
</Column>
<PropertyColumn Property="c => c.Length" Title="Original Size">
@if (context.Length > 0)
{
2025-01-29 23:02:59 -06:00
<ByteSize Value="context.Length" />
}
</PropertyColumn>
</Table>
@code {
IEnumerable<ArchiveValidationConflict> Conflicts = new List<ArchiveValidationConflict>();
IEnumerable<ArchiveValidationConflict> Selected = new List<ArchiveValidationConflict>();
bool Loading = true;
protected override async Task OnInitializedAsync()
{
await LoadData();
}
async Task Close()
{
await CloseFeedbackAsync();
}
async Task LoadData()
{
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, Options.Id, Selected.Select(e => e.FullName));
Loading = false;
StateHasChanged();
await Task.Yield();
await base.CloseFeedbackAsync();
}
}