mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
fix: possibly empty error message
This commit is contained in:
parent
ccb6632310
commit
c0fd954230
3 changed files with 28 additions and 20 deletions
|
|
@ -107,6 +107,12 @@ namespace Dalamud {
|
|||
this.LocalizationManager.SetupWithUiCulture();
|
||||
}
|
||||
|
||||
var pluginDir = this.StartInfo.PluginDirectory;
|
||||
if (this.Configuration.DoPluginTest)
|
||||
pluginDir = Path.Combine(pluginDir, "..", "testPlugins");
|
||||
|
||||
this.PluginRepository = new PluginRepository(this, pluginDir, this.StartInfo.GameVersion);
|
||||
|
||||
if (Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_INTERFACE") != "True") {
|
||||
try
|
||||
{
|
||||
|
|
@ -139,14 +145,8 @@ namespace Dalamud {
|
|||
this.BotManager.Start();
|
||||
|
||||
try {
|
||||
var pluginDir = this.StartInfo.PluginDirectory;
|
||||
if (this.Configuration.DoPluginTest)
|
||||
pluginDir = Path.Combine(pluginDir, "..", "testPlugins");
|
||||
|
||||
this.PluginManager = new PluginManager(this, pluginDir, this.StartInfo.DefaultPluginDirectory);
|
||||
this.PluginManager.LoadPlugins();
|
||||
|
||||
this.PluginRepository = new PluginRepository(this, pluginDir, this.StartInfo.GameVersion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Dalamud.Plugin
|
|||
|
||||
private bool updateComplete = false;
|
||||
private int updatePluginCount = 0;
|
||||
private PluginRepository.PluginUpdateStatus[] updatedInternalName;
|
||||
private List<PluginRepository.PluginUpdateStatus> updatedPlugins;
|
||||
|
||||
private enum PluginInstallStatus {
|
||||
None,
|
||||
|
|
@ -82,13 +82,13 @@ namespace Dalamud.Plugin
|
|||
x => x.Definition.InternalName == pluginDefinition.InternalName);
|
||||
|
||||
var label = isInstalled ? Loc.Localize("InstallerInstalled", " (installed)") : string.Empty;
|
||||
label = this.updatedInternalName != null &&
|
||||
this.updatedInternalName.Any(x => x.InternalName == pluginDefinition.InternalName && x.WasUpdated)
|
||||
label = this.updatedPlugins != null &&
|
||||
this.updatedPlugins.Any(x => x.InternalName == pluginDefinition.InternalName && x.WasUpdated)
|
||||
? Loc.Localize("InstallerUpdated", " (updated)")
|
||||
: label;
|
||||
|
||||
label = this.updatedInternalName != null &&
|
||||
this.updatedInternalName.Any(x => x.InternalName == pluginDefinition.InternalName && x.WasUpdated == false)
|
||||
label = this.updatedPlugins != null &&
|
||||
this.updatedPlugins.Any(x => x.InternalName == pluginDefinition.InternalName && x.WasUpdated == false)
|
||||
? Loc.Localize("InstallerUpdateFailed", " (update failed)")
|
||||
: label;
|
||||
|
||||
|
|
@ -190,8 +190,8 @@ namespace Dalamud.Plugin
|
|||
}
|
||||
|
||||
if (t.Result.UpdatedPlugins != null) {
|
||||
this.updatePluginCount = t.Result.UpdatedPlugins.Length;
|
||||
this.updatedInternalName = t.Result.UpdatedPlugins;
|
||||
this.updatePluginCount = t.Result.UpdatedPlugins.Count;
|
||||
this.updatedPlugins = t.Result.UpdatedPlugins;
|
||||
}
|
||||
|
||||
this.errorModalDrawing = this.installStatus == PluginInstallStatus.Fail;
|
||||
|
|
@ -215,12 +215,20 @@ namespace Dalamud.Plugin
|
|||
var message = Loc.Localize("InstallerErrorHint",
|
||||
"The plugin installer ran into an issue or the plugin is incompatible.\nPlease restart the game and report this error on our discord.");
|
||||
|
||||
if (this.updatedInternalName != null) {
|
||||
var extraInfoMessage = Loc.Localize("InstallerErrorPluginInfo", "\n\nThe following plugins caused these issues:\n\n{0}\nYou may try removing these plugins manually and reinstalling them.");
|
||||
var insert = this.updatedInternalName.Where(x => x.WasUpdated == false).Aggregate(string.Empty, (current, pluginUpdateStatus) => current + $"* {pluginUpdateStatus.InternalName}\n");
|
||||
if (this.updatedPlugins != null) {
|
||||
if (this.updatedPlugins.Any(x => x.WasUpdated == false))
|
||||
{
|
||||
var extraInfoMessage = Loc.Localize("InstallerErrorPluginInfo",
|
||||
"\n\nThe following plugins caused these issues:\n\n{0}\nYou may try removing these plugins manually and reinstalling them.");
|
||||
|
||||
var insert = this.updatedPlugins.Where(x => x.WasUpdated == false)
|
||||
.Aggregate(string.Empty,
|
||||
(current, pluginUpdateStatus) =>
|
||||
current + $"* {pluginUpdateStatus.InternalName}\n");
|
||||
extraInfoMessage = string.Format(extraInfoMessage, insert);
|
||||
message += extraInfoMessage;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Text(message);
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace Dalamud.Plugin
|
|||
public bool WasUpdated { get; set; }
|
||||
}
|
||||
|
||||
public (bool Success, PluginUpdateStatus[] UpdatedPlugins) UpdatePlugins(bool dryRun = false)
|
||||
public (bool Success, List<PluginUpdateStatus> UpdatedPlugins) UpdatePlugins(bool dryRun = false)
|
||||
{
|
||||
Log.Information("Starting plugin update... dry:{0}", dryRun);
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ namespace Dalamud.Plugin
|
|||
|
||||
Log.Information("Plugin update OK.");
|
||||
|
||||
return (!hasError, updatedList.ToArray());
|
||||
return (!hasError, updatedList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue