Very basic, but it will compare local files against what's available on the server and allow you to selectively replace them. Save paths are ignored to avoid accidental replacement. Implements #142
68 lines
2 KiB
Text
68 lines
2 KiB
Text
@using BootstrapBlazor.Components
|
|
@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">
|
|
<Selection Type="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)
|
|
{
|
|
@ByteSizeLib.ByteSize.FromBytes(context.LocalFileInfo.Length)
|
|
}
|
|
</Column>
|
|
<PropertyColumn Property="c => c.Length" Title="Original Size">
|
|
@if (context.Length > 0)
|
|
{
|
|
@ByteSizeLib.ByteSize.FromBytes(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();
|
|
}
|
|
}
|