@using LANCommander.SDK.Models @namespace LANCommander.Launcher.UI @inherits FeedbackComponent @inject GameClient GameClient @inject LocalizationService LocalizationService @context.LocalFileInfo?.CreationTime @context.LocalFileInfo?.LastWriteTime @if (context.LocalFileInfo?.Length > 0) { } @if (context.Length > 0) { } @{ GameTitleMap.TryGetValue(context.GameId.GetValueOrDefault(Guid.Empty), out var title); } @(title ?? Options.Title)
@code { IEnumerable Conflicts = new List(); IEnumerable Selected = new List(); IDictionary GameTitleMap = new Dictionary(); 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(); } }