fix warnings

This commit is contained in:
goat 2023-06-12 20:17:30 +02:00
parent faedf16d47
commit 0a829d304e
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
9 changed files with 266 additions and 189 deletions

View file

@ -327,6 +327,46 @@ internal class PluginInstallerWindow : Window, IDisposable
});
}
/// <summary>
/// A continuation task that displays any errors received into the error modal.
/// </summary>
/// <param name="task">The previous task.</param>
/// <param name="state">An error message to be displayed.</param>
/// <returns>A value indicating whether to continue with the next task.</returns>
public bool DisplayErrorContinuation(Task task, object state)
{
if (task.IsFaulted)
{
var errorModalMessage = state as string;
foreach (var ex in task.Exception.InnerExceptions)
{
if (ex is PluginException)
{
Log.Error(ex, "Plugin installer threw an error");
#if DEBUG
if (!string.IsNullOrEmpty(ex.Message))
errorModalMessage += $"\n\n{ex.Message}";
#endif
}
else
{
Log.Error(ex, "Plugin installer threw an unexpected error");
#if DEBUG
if (!string.IsNullOrEmpty(ex.Message))
errorModalMessage += $"\n\n{ex.Message}";
#endif
}
}
this.ShowErrorModal(errorModalMessage);
return false;
}
return true;
}
private void DrawProgressOverlay()
{
var pluginManager = Service<PluginManager>.Get();
@ -2155,7 +2195,7 @@ internal class PluginInstallerWindow : Window, IDisposable
this.DrawSendFeedbackButton(plugin.Manifest, plugin.IsTesting);
}
if (availablePluginUpdate != default && ! plugin.IsDev)
if (availablePluginUpdate != default && !plugin.IsDev)
this.DrawUpdateSinglePluginButton(availablePluginUpdate);
ImGui.SameLine();
@ -2914,46 +2954,6 @@ internal class PluginInstallerWindow : Window, IDisposable
private bool WasPluginSeen(string internalName) =>
Service<DalamudConfiguration>.Get().SeenPluginInternalName.Contains(internalName);
/// <summary>
/// A continuation task that displays any errors received into the error modal.
/// </summary>
/// <param name="task">The previous task.</param>
/// <param name="state">An error message to be displayed.</param>
/// <returns>A value indicating whether to continue with the next task.</returns>
public bool DisplayErrorContinuation(Task task, object state)
{
if (task.IsFaulted)
{
var errorModalMessage = state as string;
foreach (var ex in task.Exception.InnerExceptions)
{
if (ex is PluginException)
{
Log.Error(ex, "Plugin installer threw an error");
#if DEBUG
if (!string.IsNullOrEmpty(ex.Message))
errorModalMessage += $"\n\n{ex.Message}";
#endif
}
else
{
Log.Error(ex, "Plugin installer threw an unexpected error");
#if DEBUG
if (!string.IsNullOrEmpty(ex.Message))
errorModalMessage += $"\n\n{ex.Message}";
#endif
}
}
this.ShowErrorModal(errorModalMessage);
return false;
}
return true;
}
private Task ShowErrorModal(string message)
{
this.errorModalMessage = message;

View file

@ -16,6 +16,9 @@ using Serilog;
namespace Dalamud.Interface.Internal.Windows.PluginInstaller;
/// <summary>
/// ImGui widget used to manage profiles.
/// </summary>
internal class ProfileManagerWidget
{
private readonly PluginInstallerWindow installer;
@ -25,11 +28,24 @@ internal class ProfileManagerWidget
private string pickerSearch = string.Empty;
private string profileNameEdit = string.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="ProfileManagerWidget"/> class.
/// </summary>
/// <param name="installer">The plugin installer.</param>
public ProfileManagerWidget(PluginInstallerWindow installer)
{
this.installer = installer;
}
private enum Mode
{
Overview,
EditSingleProfile,
}
/// <summary>
/// Draw this widget's contents.
/// </summary>
public void Draw()
{
switch (this.mode)
@ -44,6 +60,9 @@ internal class ProfileManagerWidget
}
}
/// <summary>
/// Reset the widget.
/// </summary>
public void Reset()
{
this.mode = Mode.Overview;
@ -428,12 +447,6 @@ internal class ProfileManagerWidget
}
}
private enum Mode
{
Overview,
EditSingleProfile,
}
private static class Locs
{
public static string TooltipEnableDisable =>