Improved messaging.

This commit is contained in:
Ottermandias 2023-10-05 18:20:41 +02:00
parent 19c4c3b50e
commit 779d6b37a5
30 changed files with 146 additions and 139 deletions

View file

@ -1,6 +1,7 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Utility;
using OtterGui;
using OtterGui.Classes;
using Penumbra.Api.Enums;
using Penumbra.Communication;
using Penumbra.Meta.Manipulations;
@ -81,9 +82,7 @@ public class ModMerger : IDisposable
catch (Exception ex)
{
Error = ex;
Penumbra.Chat.NotificationMessage(
$"Could not merge {MergeFromMod!.Name} into {MergeToMod!.Name}, cleaning up changes.:\n{ex}", "Failure",
NotificationType.Error);
Penumbra.Messager.NotificationMessage(ex, $"Could not merge {MergeFromMod!.Name} into {MergeToMod!.Name}, cleaning up changes.", NotificationType.Error, false);
FailureCleanup();
DataCleanup();
}

View file

@ -1,5 +1,6 @@
using Dalamud.Interface.Internal.Notifications;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Tasks;
using Penumbra.Mods.Manager;
using Penumbra.Mods.Subclasses;
@ -74,7 +75,7 @@ public class ModNormalizer
}
catch (Exception e)
{
Penumbra.Chat.NotificationMessage($"Could not normalize mod:\n{e}", "Failure", NotificationType.Error);
Penumbra.Messager.NotificationMessage(e, $"Could not normalize mod {Mod.Name}.", NotificationType.Error, false);
}
finally
{
@ -87,17 +88,15 @@ public class ModNormalizer
{
if (Directory.Exists(_normalizationDirName))
{
Penumbra.Chat.NotificationMessage("Could not normalize mod:\n"
+ "The directory TmpNormalization may not already exist when normalizing a mod.", "Failure",
NotificationType.Error);
Penumbra.Messager.NotificationMessage($"Could not normalize mod {Mod.Name}:\n"
+ "The directory TmpNormalization may not already exist when normalizing a mod.", NotificationType.Error, false);
return false;
}
if (Directory.Exists(_oldDirName))
{
Penumbra.Chat.NotificationMessage("Could not normalize mod:\n"
+ "The directory TmpNormalizationOld may not already exist when normalizing a mod.", "Failure",
NotificationType.Error);
Penumbra.Messager.NotificationMessage($"Could not normalize mod {Mod.Name}:\n"
+ "The directory TmpNormalizationOld may not already exist when normalizing a mod.", NotificationType.Error, false);
return false;
}
@ -201,7 +200,7 @@ public class ModNormalizer
}
catch (Exception e)
{
Penumbra.Chat.NotificationMessage($"Could not normalize mod:\n{e}", "Failure", NotificationType.Error);
Penumbra.Messager.NotificationMessage(e, $"Could not normalize mod {Mod.Name}.", NotificationType.Error, false);
}
return false;
@ -229,8 +228,7 @@ public class ModNormalizer
}
catch (Exception e)
{
Penumbra.Chat.NotificationMessage($"Could not move old files out of the way while normalizing mod mod:\n{e}", "Failure",
NotificationType.Error);
Penumbra.Messager.NotificationMessage(e, $"Could not move old files out of the way while normalizing mod {Mod.Name}.", NotificationType.Error, false);
}
return false;
@ -253,8 +251,7 @@ public class ModNormalizer
}
catch (Exception e)
{
Penumbra.Chat.NotificationMessage($"Could not move new files into the mod while normalizing mod mod:\n{e}", "Failure",
NotificationType.Error);
Penumbra.Messager.NotificationMessage(e, $"Could not move new files into the mod while normalizing mod {Mod.Name}.", NotificationType.Error, false);
foreach (var dir in Mod.ModPath.EnumerateDirectories())
{
if (dir.FullName.Equals(_oldDirName, StringComparison.OrdinalIgnoreCase)

View file

@ -1,4 +1,5 @@
using Dalamud.Interface.Internal.Notifications;
using OtterGui.Classes;
using Penumbra.Import;
using Penumbra.Mods.Editor;
@ -42,8 +43,7 @@ public class ModImportManager : IDisposable
if (File.Exists(s))
return true;
Penumbra.Chat.NotificationMessage($"Failed to import queued mod at {s}, the file does not exist.", "Warning",
NotificationType.Warning);
Penumbra.Messager.NotificationMessage($"Failed to import queued mod at {s}, the file does not exist.", NotificationType.Warning, false);
return false;
}).Select(s => new FileInfo(s)).ToArray();

View file

@ -1,5 +1,6 @@
using Dalamud.Interface.Internal.Notifications;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Filesystem;
using Penumbra.Api.Enums;
using Penumbra.Meta.Manipulations;
@ -395,9 +396,9 @@ public class ModOptionEditor
return true;
if (message)
Penumbra.Chat.NotificationMessage(
Penumbra.Messager.NotificationMessage(
$"Could not name option {newName} because option with same filename {path} already exists.",
"Warning", NotificationType.Warning);
NotificationType.Warning, false);
return false;
}

View file

@ -2,6 +2,7 @@ using Dalamud.Interface.Internal.Notifications;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Filesystem;
using Penumbra.Api.Enums;
using Penumbra.GameData;
@ -45,8 +46,7 @@ public partial class ModCreator
}
catch (Exception e)
{
Penumbra.Chat.NotificationMessage($"Could not create directory for new Mod {newName}:\n{e}", "Failure",
NotificationType.Error);
Penumbra.Messager.NotificationMessage(e, $"Could not create directory for new Mod {newName}.", NotificationType.Error, false);
return null;
}
}

View file

@ -2,6 +2,7 @@ using Dalamud.Interface.Internal.Notifications;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Filesystem;
using Penumbra.Api.Enums;
@ -54,9 +55,8 @@ public sealed class MultiModGroup : IModGroup
{
if (ret.PrioritizedOptions.Count == IModGroup.MaxMultiOptions)
{
Penumbra.Chat.NotificationMessage(
$"Multi Group {ret.Name} has more than {IModGroup.MaxMultiOptions} options, ignoring excessive options.", "Warning",
NotificationType.Warning);
Penumbra.Messager.NotificationMessage(
$"Multi Group {ret.Name} in {mod.Name} has more than {IModGroup.MaxMultiOptions} options, ignoring excessive options.", NotificationType.Warning);
break;
}