mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
Improvements (#903)
This commit is contained in:
parent
e9cd7e0273
commit
716736f022
55 changed files with 1809 additions and 872 deletions
|
|
@ -15,6 +15,7 @@ using Dalamud.Game;
|
|||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Logging.Internal;
|
||||
using ImGuiNET;
|
||||
using Microsoft.Win32;
|
||||
using Serilog;
|
||||
|
|
@ -536,6 +537,31 @@ namespace Dalamud.Utility
|
|||
obj.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose this object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to dispose.</param>
|
||||
/// <param name="logMessage">Log message to print, if specified and an error occurs.</param>
|
||||
/// <param name="moduleLog">Module logger, if any.</param>
|
||||
/// <typeparam name="T">The type of object to dispose.</typeparam>
|
||||
internal static void ExplicitDisposeIgnoreExceptions<T>(this T obj, string? logMessage = null, ModuleLog? moduleLog = null) where T : IDisposable
|
||||
{
|
||||
try
|
||||
{
|
||||
obj.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (logMessage == null)
|
||||
return;
|
||||
|
||||
if (moduleLog != null)
|
||||
moduleLog.Error(e, logMessage);
|
||||
else
|
||||
Log.Error(e, logMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private static unsafe void ShowValue(ulong addr, IEnumerable<string> path, Type type, object value)
|
||||
{
|
||||
if (type.IsPointer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue