2024-08-26 20:18:54 -05:00
|
|
|
@using LANCommander.Launcher.Data.Models
|
2025-11-23 20:53:45 -06:00
|
|
|
@using LANCommander.Launcher.Settings
|
2025-01-30 23:57:12 -06:00
|
|
|
@using LANCommander.SDK
|
2025-11-29 18:24:27 -06:00
|
|
|
@using LANCommander.SDK.Enums
|
2024-08-01 17:21:44 -05:00
|
|
|
@using LANCommander.SDK.Helpers
|
2025-10-05 17:13:47 -05:00
|
|
|
@using LANCommander.SDK.Services
|
2025-11-26 22:38:04 -06:00
|
|
|
@using Microsoft.Extensions.Options
|
2025-10-15 21:47:28 -05:00
|
|
|
@namespace LANCommander.Launcher.UI
|
2024-08-01 17:21:44 -05:00
|
|
|
@inject GameService GameService
|
2025-01-20 12:10:30 -06:00
|
|
|
@inject UserService UserService
|
2024-08-01 17:21:44 -05:00
|
|
|
@inject LibraryService LibraryService
|
2024-10-26 15:48:47 -05:00
|
|
|
@inject InstallService InstallService
|
2024-08-01 17:21:44 -05:00
|
|
|
@inject ModalService ModalService
|
2025-10-15 20:21:54 -05:00
|
|
|
@inject MessageService MessageService
|
|
|
|
|
@inject ILogger<LibraryItemContextMenu> Logger
|
2025-10-05 17:13:47 -05:00
|
|
|
@inject IConnectionClient ConnectionClient
|
2025-11-26 22:38:04 -06:00
|
|
|
@inject GameClient GameClient
|
|
|
|
|
@inject ScriptClient ScriptClient
|
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
|
2025-11-26 22:38:04 -06:00
|
|
|
@inject IOptions<Settings> Settings
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
@if (GameActions != null && GameActions.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
@foreach (var action in GameActions.OrderBy(a => a.SortOrder))
|
|
|
|
|
{
|
2025-06-08 04:21:24 +02:00
|
|
|
<MenuItem OnClick="() => Run(Game, action)" Class="@(action.IsPrimaryAction ? "primary-action" : "")">
|
2024-08-01 17:21:44 -05:00
|
|
|
@action.Name
|
|
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<MenuDivider />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (Game.Installed)
|
|
|
|
|
{
|
|
|
|
|
if (Game.Media != null && Game.Media.Any(m => m.Type == SDK.Enums.MediaType.Manual))
|
|
|
|
|
{
|
|
|
|
|
foreach (var manual in Game.Media.Where(m => m.Type == SDK.Enums.MediaType.Manual))
|
|
|
|
|
{
|
|
|
|
|
<MenuItem OnClick="() => OpenManual(manual)">
|
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.IsNullOrWhiteSpace(manual.Name) ? LocalizationService.GetString("Manual") : manual.Name)
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<MenuDivider />
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => OpenSaveManager()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("ManageSaves")
|
2024-10-23 18:17:01 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
|
2025-11-29 18:24:27 -06:00
|
|
|
if (Settings.Value.Games.InstallDirectories.Length > 1 || Game.DependentGames.Any(g => g.Type == GameType.Expansion || g.Type == GameType.Mod))
|
2024-10-26 15:48:47 -05:00
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => Modify()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("Modify")
|
2024-10-26 15:48:47 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-01 17:21:44 -05:00
|
|
|
<MenuItem OnClick="() => BrowseFiles()">
|
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
|
|
|
@LocalizationService.GetString("BrowseFiles")
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => ValidateFiles()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("ValidateFiles")
|
2024-11-04 17:31:37 -06:00
|
|
|
</MenuItem>
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => RemoveFromLibrary()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("Remove")
|
2024-11-13 22:48:43 -06:00
|
|
|
</MenuItem>
|
2024-08-01 17:21:44 -05:00
|
|
|
<MenuItem OnClick="() => Uninstall()">
|
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
|
|
|
@LocalizationService.GetString("Uninstall")
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => Install()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("Install")
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => RemoveFromLibrary()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("Remove")
|
2024-11-13 22:48:43 -06:00
|
|
|
</MenuItem>
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
|
2025-11-26 22:38:04 -06:00
|
|
|
@if (Settings.Value.Debug.EnableScriptDebugging)
|
2024-08-01 17:21:44 -05:00
|
|
|
{
|
|
|
|
|
<MenuDivider />
|
|
|
|
|
|
|
|
|
|
<MenuItem OnClick="() => RunInstallScripts()">
|
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
|
|
|
@LocalizationService.GetString("RunInstallScripts")
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
|
2024-09-28 16:50:19 -05:00
|
|
|
<MenuItem OnClick="() => RunUninstallScripts()">
|
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
|
|
|
@LocalizationService.GetString("RunUninstallScripts")
|
2024-09-28 16:50:19 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
|
2024-08-01 17:21:44 -05:00
|
|
|
<MenuItem OnClick="() => RunNameChangeScripts()">
|
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
|
|
|
@LocalizationService.GetString("RunNameChangeScripts")
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
|
|
|
|
|
<MenuItem OnClick="() => RunKeyChangeScripts()">
|
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
|
|
|
@LocalizationService.GetString("RunKeyChangeScripts")
|
2024-08-01 17:21:44 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-26 20:18:54 -05:00
|
|
|
<MenuDivider />
|
|
|
|
|
|
2025-10-05 17:13:47 -05:00
|
|
|
<MenuItem OnClick="() => ReportIssue()" Disabled="@ConnectionClient.IsOfflineMode()">
|
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
|
|
|
@LocalizationService.GetString("ReportIssue")
|
2024-08-11 14:48:00 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
|
2024-08-01 17:21:44 -05:00
|
|
|
@MenuExtra
|
|
|
|
|
|
|
|
|
|
@code {
|
2024-11-09 17:15:04 -06:00
|
|
|
[Parameter] public Models.ListItem Model { get; set; }
|
2024-08-01 17:21:44 -05:00
|
|
|
[Parameter] public RenderFragment MenuExtra { get; set; }
|
2025-06-08 04:21:24 +02:00
|
|
|
[Parameter] public bool ShowPrimaryActions { get; set; }
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
Data.Models.Game Game { get; set; }
|
2025-11-29 18:24:27 -06:00
|
|
|
IEnumerable<SDK.Models.Manifest.Action> GameActions { get; set; } = [];
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
|
|
|
{
|
2025-06-08 03:44:34 +02:00
|
|
|
if (Model.DataItem is Game game)
|
2024-08-01 17:21:44 -05:00
|
|
|
{
|
2025-06-08 03:44:34 +02:00
|
|
|
Game = game;
|
2025-11-29 18:24:27 -06:00
|
|
|
List<SDK.Models.Manifest.Action> actions = [];
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
if (Game.Installed)
|
|
|
|
|
{
|
2025-11-29 18:24:27 -06:00
|
|
|
var manifest = await ManifestHelper.ReadAsync<SDK.Models.Manifest.Game>(Game.InstallDirectory, Game.Id);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
2024-08-08 18:28:33 -05:00
|
|
|
if (manifest != null)
|
2025-06-08 04:21:24 +02:00
|
|
|
{
|
|
|
|
|
actions = manifest.Actions.Where(a => ShowPrimaryActions || !a.IsPrimaryAction).ToList();
|
|
|
|
|
}
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
2025-06-08 03:44:34 +02:00
|
|
|
|
|
|
|
|
GameActions = actions;
|
|
|
|
|
StateHasChanged();
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-29 18:24:27 -06:00
|
|
|
async Task Run(Game game, SDK.Models.Manifest.Action action)
|
2024-08-01 17:21:44 -05:00
|
|
|
{
|
2024-09-05 00:48:04 -05:00
|
|
|
var task = GameService.Run(game, action);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
await InvokeAsync(StateHasChanged);
|
2024-08-26 20:18:54 -05:00
|
|
|
|
|
|
|
|
await task;
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
|
2025-10-15 20:21:54 -05:00
|
|
|
void BrowseFiles()
|
2024-08-01 17:21:44 -05:00
|
|
|
{
|
2025-10-15 20:21:54 -05:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!SystemService.TryBrowseFiles(Game.InstallDirectory))
|
|
|
|
|
MessageService.Error("Could not open file manager!");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.LogError(ex, "Error opening file manager to {Path}", Game.InstallDirectory);
|
|
|
|
|
MessageService.Error("Could not open file manager!");
|
|
|
|
|
}
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task Install()
|
|
|
|
|
{
|
2025-11-29 18:24:27 -06:00
|
|
|
if (Settings.Value.Games.InstallDirectories.Length > 1 || (Model.DataItem as Game).DependentGames.Any(g => g.Type == GameType.Expansion || g.Type == GameType.Mod))
|
2024-09-12 19:09:13 -05:00
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
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
|
|
|
Title = LocalizationService.GetString("InstallGame", Model.Name),
|
2024-09-12 19:09:13 -05:00
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
|
|
|
|
Draggable = true,
|
2024-10-26 15:48:47 -05:00
|
|
|
Centered = true,
|
|
|
|
|
WrapClassName = "ant-modal-wrap-no-padding",
|
|
|
|
|
Footer = null,
|
2024-09-12 19:09:13 -05:00
|
|
|
};
|
|
|
|
|
|
2024-11-09 17:15:04 -06:00
|
|
|
var modalRef = ModalService.CreateModal<InstallDialog, Models.ListItem, string>(modalOptions, Model);
|
2024-09-12 19:09:13 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-10-26 15:48:47 -05:00
|
|
|
var game = Model.DataItem as Game;
|
|
|
|
|
|
|
|
|
|
await InstallService.Add(game);
|
2024-09-12 19:09:13 -05:00
|
|
|
}
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
async Task Modify()
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
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
|
|
|
Title = LocalizationService.GetString("ModifyGame", Model.Name),
|
2024-10-26 15:48:47 -05:00
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
|
|
|
|
Draggable = true,
|
|
|
|
|
Centered = true,
|
|
|
|
|
WrapClassName = "ant-modal-wrap-no-padding",
|
|
|
|
|
Footer = null,
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-09 17:15:04 -06:00
|
|
|
var modalRef = ModalService.CreateModal<InstallDialog, Models.ListItem, string>(modalOptions, Model);
|
2024-10-26 15:48:47 -05:00
|
|
|
}
|
|
|
|
|
|
2024-11-04 17:31:37 -06:00
|
|
|
async Task ValidateFiles()
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
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
|
|
|
Title = LocalizationService.GetString("FileConflicts"),
|
2024-11-04 17:31:37 -06:00
|
|
|
Maximizable = false,
|
2024-11-14 20:53:08 -06:00
|
|
|
DefaultMaximized = true,
|
2024-11-04 17:31:37 -06:00
|
|
|
Closable = true,
|
|
|
|
|
Draggable = true,
|
|
|
|
|
Centered = true,
|
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
|
|
|
OkText = LocalizationService.GetString("ReplaceSelected"),
|
2024-11-04 17:31:37 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var modalRef = ModalService.CreateModal<ValidateFilesDialog, Game>(modalOptions, Model.DataItem as Game);
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-01 17:21:44 -05:00
|
|
|
async Task Uninstall()
|
|
|
|
|
{
|
2025-11-29 18:24:27 -06:00
|
|
|
var manifest = await ManifestHelper.ReadAsync<SDK.Models.Manifest.Game>(Game.InstallDirectory, Game.Id);
|
2024-08-01 17:21:44 -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
|
|
|
string message;
|
2024-08-01 17:21:44 -05:00
|
|
|
if (manifest.SavePaths != null && manifest.SavePaths.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
|
|
|
message = LocalizationService.GetString("UninstallGameMessageWithSaves", Game.Title);
|
2024-08-01 17:21:44 -05:00
|
|
|
else
|
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
|
|
|
message = LocalizationService.GetString("UninstallGameMessageWithoutSaves", Game.Title);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
var confirmed = await ModalService.ConfirmAsync(new ConfirmOptions
|
|
|
|
|
{
|
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
|
|
|
OkText = LocalizationService.GetString("UninstallGame"),
|
|
|
|
|
CancelText = LocalizationService.GetString("Cancel"),
|
|
|
|
|
Title = LocalizationService.GetString("UninstallGame"),
|
2024-08-01 17:21:44 -05:00
|
|
|
Content = message,
|
2024-12-31 18:21:41 -06:00
|
|
|
OkButtonProps = new ButtonProps()
|
|
|
|
|
{
|
|
|
|
|
Danger = true
|
|
|
|
|
},
|
2024-08-01 17:21:44 -05:00
|
|
|
Centered = true,
|
|
|
|
|
Icon = @<Icon Type="@IconType.Outline.Delete" />
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (confirmed)
|
2024-08-07 01:51:15 -05:00
|
|
|
await GameService.UninstallAsync(Game);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
InstallService.Remove(Game.Id);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
await LibraryService.LibraryChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 22:48:43 -06:00
|
|
|
async Task RemoveFromLibrary()
|
|
|
|
|
{
|
2025-05-25 18:35:01 +02:00
|
|
|
var hasStandaloneDependent = Game.DependentGames?
|
2025-11-29 18:24:27 -06:00
|
|
|
.Where(g => g.Type != GameType.Expansion && g.Type != GameType.Mod)
|
2025-05-25 18:35:01 +02:00
|
|
|
.Any(g => LibraryService.IsInLibrary(g.Id)) ?? false;
|
|
|
|
|
|
|
|
|
|
if (!hasStandaloneDependent)
|
|
|
|
|
{
|
|
|
|
|
await LibraryService.RemoveFromLibraryAsync(Game.Id);
|
2025-05-25 22:19:55 +02:00
|
|
|
await LibraryService.RefreshItemsAsync(true);
|
2025-05-25 18:35:01 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
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
|
|
|
Title = LocalizationService.GetString("RemoveGameFromLibrary"),
|
2025-05-25 18:35:01 +02:00
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
|
|
|
|
Draggable = true,
|
|
|
|
|
Centered = true,
|
|
|
|
|
WrapClassName = "ant-modal-wrap-no-padding",
|
|
|
|
|
Footer = null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var modalRef = ModalService.CreateModal<RemoveFromLibraryDialog, Models.ListItem, string>(modalOptions, Model);
|
2024-11-13 22:48:43 -06:00
|
|
|
}
|
|
|
|
|
|
2024-08-01 17:21:44 -05:00
|
|
|
async Task RunInstallScripts()
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
var manifests = await GameClient.GetManifestsAsync(Game.InstallDirectory, Game.Id);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
foreach (var manifest in manifests)
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
await ScriptClient.RunInstallScriptAsync(Game.InstallDirectory, manifest.Id);
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-28 16:50:19 -05:00
|
|
|
async Task RunUninstallScripts()
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
var manifests = await GameClient.GetManifestsAsync(Game.InstallDirectory, Game.Id);
|
2024-09-28 16:50:19 -05:00
|
|
|
|
|
|
|
|
foreach (var manifest in manifests)
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
await ScriptClient.RunUninstallScriptAsync(Game.InstallDirectory, manifest.Id);
|
2024-09-28 16:50:19 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-01 17:21:44 -05:00
|
|
|
async Task RunNameChangeScripts()
|
|
|
|
|
{
|
2025-01-20 12:10:30 -06:00
|
|
|
var user = await UserService.GetCurrentUser();
|
2025-11-26 22:38:04 -06:00
|
|
|
var manifests = await GameClient.GetManifestsAsync(Game.InstallDirectory, Game.Id);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
foreach (var manifest in manifests)
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
await ScriptClient.RunNameChangeScriptAsync(Game.InstallDirectory, Game.Id, user.GetUserNameSafe ?? SDK.Models.Settings.DEFAULT_GAME_USERNAME);
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task RunKeyChangeScripts()
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
var manifests = await GameClient.GetManifestsAsync(Game.InstallDirectory, Game.Id);
|
2024-08-01 17:21:44 -05:00
|
|
|
|
|
|
|
|
foreach (var manifest in manifests)
|
|
|
|
|
{
|
2025-11-26 22:38:04 -06:00
|
|
|
var key = await GameClient.GetAllocatedKeyAsync(manifest.Id);
|
2024-08-05 20:29:12 -05:00
|
|
|
|
2025-11-26 22:38:04 -06:00
|
|
|
await ScriptClient.RunKeyChangeScriptAsync(Game.InstallDirectory, Game.Id, key);
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task OpenManual(Media media)
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
|
|
|
|
Title = media.Name,
|
|
|
|
|
Maximizable = true,
|
|
|
|
|
DefaultMaximized = true,
|
|
|
|
|
Closable = true,
|
|
|
|
|
Footer = null,
|
|
|
|
|
Draggable = true,
|
|
|
|
|
Resizable = true,
|
|
|
|
|
WrapClassName = "pdf-reader-dialog",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var modalRef = await ModalService.CreateModalAsync<PdfReaderDialog, Media>(modalOptions, media);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-23 18:17:01 -05:00
|
|
|
async Task OpenSaveManager()
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
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
|
|
|
Title = LocalizationService.GetString("ManageSaves"),
|
2024-10-23 18:17:01 -05:00
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
|
|
|
|
Draggable = true,
|
2024-10-24 02:29:26 -05:00
|
|
|
Resizable = true,
|
|
|
|
|
WrapClassName = "ant-modal-wrap-no-padding",
|
|
|
|
|
Footer = null,
|
2024-10-23 18:17:01 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var modalRef = await ModalService.CreateModalAsync<SavesDialog, Game>(modalOptions, Game);
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-11 14:48:00 -05:00
|
|
|
async Task ReportIssue()
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
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
|
|
|
Title = LocalizationService.GetString("ReportIssue"),
|
2024-08-11 14:48:00 -05:00
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
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
|
|
|
OkText = LocalizationService.GetString("Submit"),
|
2024-09-09 18:20:27 -05:00
|
|
|
Draggable = true
|
2024-08-11 14:48:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var modalRef = ModalService.CreateModal<ReportIssueDialog, Game, SDK.Models.Issue>(modalOptions, Game);
|
|
|
|
|
}
|
2024-08-01 17:21:44 -05:00
|
|
|
}
|