2025-01-12 02:54:41 -06:00
|
|
|
@using LANCommander.Launcher.Data.Models
|
2024-09-12 19:09:13 -05:00
|
|
|
@using LANCommander.Launcher.Models
|
2025-01-12 02:54:41 -06:00
|
|
|
@using LANCommander.SDK.Extensions
|
2024-11-09 17:15:04 -06:00
|
|
|
@inherits FeedbackComponent<Models.ListItem, string>
|
2024-10-26 15:48:47 -05:00
|
|
|
@inject InstallService InstallService
|
2024-10-12 12:04:00 -05:00
|
|
|
@inject SDK.Client Client
|
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
|
|
|
@inject LocalizationService LocalizationService
|
2024-10-12 12:04:00 -05:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
<div style="padding: 16px;">
|
|
|
|
|
<Row Gutter="16">
|
|
|
|
|
<Col Span="12">
|
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
|
|
|
<Statistic Title="@LocalizationService.GetString("DownloadSize")" Value="@ByteSizeLib.ByteSize.FromBytes(GetDownloadSize()).ToString()" Style="text-align: center;"/>
|
2024-10-26 15:48:47 -05:00
|
|
|
</Col>
|
|
|
|
|
<Col Span="12">
|
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
|
|
|
<Statistic Title="@LocalizationService.GetString("SpaceRequired")" Value="@ByteSizeLib.ByteSize.FromBytes(GetSpaceRequired()).ToString()" Style="text-align: center;"/>
|
2024-10-26 15:48:47 -05:00
|
|
|
</Col>
|
|
|
|
|
</Row>
|
2024-09-12 19:09:13 -05:00
|
|
|
|
2024-10-25 20:46:54 -05:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
@if (Addons.Any())
|
|
|
|
|
{
|
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
|
|
|
<Divider Text="@LocalizationService.GetString("Addons")" />
|
2024-10-25 20:46:54 -05:00
|
|
|
|
2025-01-27 02:46:05 -06:00
|
|
|
<CheckboxButtonGroup @bind-Selected="SelectedAddons" DataSource="Addons" KeySelector="a => a.Id" LabelSelector="a => a.Title" Direction="SpaceDirection.Vertical" />
|
2024-10-26 15:48:47 -05:00
|
|
|
}
|
2024-10-09 19:23:42 -05:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
@if (Settings.Games.InstallDirectories.Length > 1)
|
|
|
|
|
{
|
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
|
|
|
<Divider Text="@LocalizationService.GetString("InstallLocation")" />
|
2024-12-31 18:21:41 -06:00
|
|
|
<RadioGroup @bind-Value="SelectedDirectory" ButtonStyle="RadioButtonStyle.Solid" Size="InputSize.Large" Class="install-dialog-directory-selector radio-group-vertical radio-group-block">
|
2024-10-25 20:46:54 -05:00
|
|
|
@foreach (var directory in Settings.Games.InstallDirectories)
|
|
|
|
|
{
|
|
|
|
|
<Radio RadioButton Value="@directory">
|
|
|
|
|
<GridRow>
|
|
|
|
|
<GridCol Flex="@("auto")">
|
|
|
|
|
@directory
|
|
|
|
|
</GridCol>
|
|
|
|
|
<GridCol>
|
2025-01-29 23:02:59 -06:00
|
|
|
<ByteSize Value="GetFreeSpace(directory)" />
|
2024-10-25 20:46:54 -05:00
|
|
|
</GridCol>
|
|
|
|
|
</GridRow>
|
|
|
|
|
</Radio>
|
|
|
|
|
}
|
|
|
|
|
</RadioGroup>
|
2024-10-26 15:48:47 -05:00
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
2024-12-31 18:21:41 -06:00
|
|
|
<Flex Gap="FlexGap.Middle" Style="padding: 16px; padding-top: 0px" Justify="FlexJustify.FlexEnd">
|
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
|
|
|
@if (GetOperation() != "None")
|
2024-10-26 15:48:47 -05:00
|
|
|
{
|
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
|
|
|
<Button Type="ButtonType.Primary" OnClick="Install">@LocalizationService.GetString(GetOperation())</Button>
|
2024-10-26 15:48:47 -05:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
<Button OnClick="() => Close()">@LocalizationService.GetString("Close")</Button>
|
2024-10-26 15:48:47 -05:00
|
|
|
</Flex>
|
2024-09-12 19:09:13 -05:00
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
Settings Settings = SettingService.GetSettings();
|
|
|
|
|
|
|
|
|
|
string SelectedDirectory = "";
|
2024-10-26 15:48:47 -05:00
|
|
|
|
2024-10-12 12:04:00 -05:00
|
|
|
SDK.Models.Game RemoteGame;
|
2024-10-26 15:48:47 -05:00
|
|
|
Data.Models.Game Game;
|
2024-10-09 19:23:42 -05:00
|
|
|
|
2025-05-15 03:04:48 +02:00
|
|
|
List<SDK.Models.Game> Addons = new();
|
2025-01-27 02:46:05 -06:00
|
|
|
IEnumerable<SDK.Models.Game> SelectedAddons = new List<SDK.Models.Game>();
|
2024-09-12 19:09:13 -05:00
|
|
|
|
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
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
|
2024-10-12 12:04:00 -05:00
|
|
|
protected override async Task OnInitializedAsync()
|
2024-09-12 19:09:13 -05:00
|
|
|
{
|
2024-10-26 15:48:47 -05:00
|
|
|
Game = Options.DataItem as Game;
|
2025-05-15 03:04:48 +02:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
if (Game.Installed)
|
|
|
|
|
SelectedDirectory = Settings.Games.InstallDirectories.FirstOrDefault(d => Game.InstallDirectory.StartsWith(d));
|
|
|
|
|
|
|
|
|
|
if (String.IsNullOrWhiteSpace(SelectedDirectory))
|
|
|
|
|
SelectedDirectory = Settings.Games.InstallDirectories.First();
|
2024-10-09 19:23:42 -05:00
|
|
|
|
2025-01-27 21:07:38 -06:00
|
|
|
RemoteGame = await Client.Games.GetAsync(Options.Key);
|
2025-01-27 01:25:32 -06:00
|
|
|
Addons = (await Client.Games.GetAddonsAsync(Options.Key)).OrderByTitle(g => g.SortTitle ?? g.Title).ToList();
|
2025-05-15 03:04:48 +02:00
|
|
|
|
|
|
|
|
var localAddons = Game?.DependentGames.Where(g => g.Installed).Select(addon => addon.Id).ToArray() ?? [];
|
|
|
|
|
SelectedAddons = Addons?.Where(addon => localAddons.Contains(addon.Id)).ToList() ?? [];
|
2024-09-12 19:09:13 -05:00
|
|
|
}
|
|
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
async Task Close()
|
2024-09-12 19:09:13 -05:00
|
|
|
{
|
2024-10-26 15:48:47 -05:00
|
|
|
await CloseFeedbackAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task Install()
|
|
|
|
|
{
|
|
|
|
|
var game = Options.DataItem as Game;
|
|
|
|
|
|
2025-05-15 03:04:48 +02:00
|
|
|
InstallService.Add(game, SelectedDirectory, SelectedAddons.ToArray());
|
2024-11-12 02:17:26 -06:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
await CloseFeedbackAsync();
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
string GetOperation()
|
2024-10-26 15:48:47 -05:00
|
|
|
{
|
|
|
|
|
if (!Game.Installed)
|
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
|
|
|
return "Install";
|
2024-10-26 15:48:47 -05:00
|
|
|
|
2025-05-16 01:04:03 +02:00
|
|
|
if (Game.DependentGames.Any(g => g.Installed ^ SelectedAddons.Any(a => a.Id == g.Id)))
|
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
|
|
|
return "Modify";
|
2024-10-26 15:48:47 -05:00
|
|
|
|
|
|
|
|
if (!Game.InstallDirectory.StartsWith(SelectedDirectory))
|
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
|
|
|
return "Move";
|
2024-10-26 15:48:47 -05:00
|
|
|
|
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
|
|
|
return string.Empty;
|
2024-10-09 19:23:42 -05:00
|
|
|
}
|
|
|
|
|
|
2024-10-12 12:04:00 -05:00
|
|
|
long GetDownloadSize()
|
|
|
|
|
{
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
|
|
if (RemoteGame != null && RemoteGame.Archives.Any())
|
|
|
|
|
{
|
|
|
|
|
size += RemoteGame.Archives.OrderByDescending(a => a.CreatedOn).First().CompressedSize;
|
|
|
|
|
|
2025-01-27 21:07:38 -06:00
|
|
|
size += SelectedAddons.Sum(a => a.Archives.OrderByDescending(arc => arc.CreatedOn).First().CompressedSize);
|
2024-10-12 12:04:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long GetSpaceRequired()
|
|
|
|
|
{
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
|
|
if (RemoteGame != null && RemoteGame.Archives.Any())
|
|
|
|
|
{
|
|
|
|
|
size += RemoteGame.Archives.OrderByDescending(a => a.CreatedOn).First().UncompressedSize;
|
|
|
|
|
|
2025-01-27 21:07:38 -06:00
|
|
|
size += SelectedAddons.Sum(a => a.Archives.OrderByDescending(arc => arc.CreatedOn).First().UncompressedSize);
|
2024-10-12 12:04:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-12 19:09:13 -05:00
|
|
|
long GetFreeSpace(string path)
|
|
|
|
|
{
|
|
|
|
|
var root = Path.GetPathRoot(path);
|
|
|
|
|
var drive = new DriveInfo(path);
|
|
|
|
|
|
|
|
|
|
return drive.AvailableFreeSpace;
|
|
|
|
|
}
|
|
|
|
|
}
|