Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Stardrop/Models/SMAPI/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public class Manifest
//[JsonConverter(typeof(ManifestDependencyArrayConverter))]
public ManifestDependency[] Dependencies { get; set; }

// <summary>Custom property for Stardrop.</summary>
/// <summary>Custom property for Stardrop.</summary>
public bool DeleteOldVersion { get; set; }

/// <summary>Custom property for Stardrop.</summary>
public string? UpdateCautionMessage { get; set; }
}
}
24 changes: 24 additions & 0 deletions Stardrop/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,25 @@ private async Task<List<Mod>> AddMods(string[]? filePaths)
continue;
}

// If this is a mod update and if the Manifest.UpdateCautionMessage has a value, display message (and confirm if user wants to continue with mod update)
bool shouldProceedWithUpdate = true;
foreach (var manifest in pathToManifests.Values.Where(m => m is not null && HasModInstalled(m.UniqueID) is true && string.IsNullOrEmpty(m.UpdateCautionMessage) is false))
{
var requestWindow = new MessageWindow(String.Format(Program.translation.Get("ui.message.confirm_mod_update_caution"), manifest!.Name, manifest!.UpdateCautionMessage)) { Topmost = true };
if (await requestWindow.ShowDialog<bool>(this) is false)
{
Program.helper.Log($"User elected to skip mod update due to given Manifest.UpdateCautionMessage message for mod {manifest!.UniqueID}:{manifest!.UpdateCautionMessage}");
shouldProceedWithUpdate = false;
break;
}
}

// Skip updating if user elected to skip any of the bundled mods due to Manifest.UpdateCautionMessage
if (shouldProceedWithUpdate is false)
{
continue;
}

int currentManifestIndex = 1;
bool alwaysAskToDelete = Program.settings.AlwaysAskToDelete;
foreach (var manifestPath in pathToManifests.Keys)
Expand Down Expand Up @@ -2438,6 +2457,11 @@ private async Task<List<Mod>> AddMods(string[]? filePaths)
return addedMods;
}

private bool HasModInstalled(string uniqueID)
{
return _viewModel.Mods.Any(m => m.UniqueId.Equals(uniqueID, StringComparison.OrdinalIgnoreCase));
}

private void CreateDirectoryJunctions(List<string> arguments)
{
// Prepare the process
Expand Down
5 changes: 3 additions & 2 deletions Stardrop/i18n/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@
"ui.downloads_panel.download_canceled": "Canceled",
"ui.downloads_panel.download_failed": "Failed",
"ui_downloads_panel.download_success": "Complete!",
"ui.downloads_panel.no_downloads_label": "No downloads in progress",
"ui.downloads_panel.no_downloads_label": "No downloads in progress",

// Downloads Panel - Tooltips
"ui.downloads_panel.tooltips.cancel_button": "Cancel",
"ui.downloads_panel.tooltips.cancel_button": "Cancel",
"ui.downloads_panel.tooltips.remove_button": "Remove", // Tooltip for the button that clears out a completed or failed download

// Warnings
Expand Down Expand Up @@ -228,6 +228,7 @@
"ui.message.confirm_nxm_install": "Would you like to install the following mod:\n\n{0}\n\nYou can disable this confirmation in the settings menu.",
"ui.message.require_nexus_login": "This action requires being signed into the Nexus Mods API.",
"ui.message.succeeded_nexus_install": "Successfully installed the following mod via Nexus Mods:\n\n{0}",
"ui.message.confirm_mod_update_caution": "{0}\nUpdate Caution Message:\n\n{1}\n\nProceed with the mod update?",

// Window Names
"ui.window.settings.name": "Settings",
Expand Down
Loading