Fix FileSystemSelector bug and add notifications on failures.

This commit is contained in:
Ottermandias 2023-03-24 18:32:27 +01:00
parent c8415e3079
commit 5cad575c2e
2 changed files with 12 additions and 9 deletions

@ -1 +1 @@
Subproject commit e49a05e1863957144955d1c612343ccfff11563e Subproject commit 2cc26d04a0ec162b71544ff164d1ca768fb90c95

View file

@ -41,7 +41,7 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
public ModFileSystemSelector(CommunicatorService communicator, ModFileSystem fileSystem, Mod.Manager modManager, public ModFileSystemSelector(CommunicatorService communicator, ModFileSystem fileSystem, Mod.Manager modManager,
ModCollection.Manager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat, ModCollection.Manager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat,
ModEditor modEditor) ModEditor modEditor)
: base(fileSystem, DalamudServices.KeyState) : base(fileSystem, DalamudServices.KeyState, HandleException)
{ {
_communicator = communicator; _communicator = communicator;
_modManager = modManager; _modManager = modManager;
@ -265,13 +265,13 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
_import.DrawProgressInfo(new Vector2(-1, ImGui.GetFrameHeight())); _import.DrawProgressInfo(new Vector2(-1, ImGui.GetFrameHeight()));
} }
if (_import.State == ImporterState.Done && ImGui.Button("Close", -Vector2.UnitX) if ((_import.State != ImporterState.Done || !ImGui.Button("Close", -Vector2.UnitX))
|| _import.State != ImporterState.Done && _import.DrawCancelButton(-Vector2.UnitX)) && (_import.State == ImporterState.Done || !_import.DrawCancelButton(-Vector2.UnitX)))
{ return;
_import?.Dispose();
_import = null; _import?.Dispose();
ImGui.CloseCurrentPopup(); _import = null;
} ImGui.CloseCurrentPopup();
} }
/// <summary> Mods need to be added thread-safely outside of iteration. </summary> /// <summary> Mods need to be added thread-safely outside of iteration. </summary>
@ -423,6 +423,9 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
}); });
} }
private static void HandleException(Exception e)
=> Penumbra.ChatService.NotificationMessage(e.Message, "Failure", NotificationType.Warning);
#endregion #endregion
#region Automatic cache update functions. #region Automatic cache update functions.