naming adjustments

This commit is contained in:
Stanley Dimant 2022-09-01 21:40:23 +02:00
parent 652b357341
commit 2317d28b39
8 changed files with 34 additions and 34 deletions

View file

@ -146,7 +146,7 @@ namespace Dalamud.Game.ClientState
private IntPtr SetupTerritoryTypeDetour(IntPtr manager, ushort terriType)
{
this.TerritoryType = terriType;
this.TerritoryChanged?.Raise(this, terriType);
this.TerritoryChanged?.InvokeSafely(this, terriType);
Log.Debug("TerritoryType changed: {0}", terriType);
@ -155,7 +155,7 @@ namespace Dalamud.Game.ClientState
private void NetworkHandlersOnCfPop(object sender, Lumina.Excel.GeneratedSheets.ContentFinderCondition e)
{
this.CfPop?.Raise(this, e);
this.CfPop?.InvokeSafely(this, e);
}
private void FrameworkOnOnUpdateEvent(Framework framework1)
@ -172,7 +172,7 @@ namespace Dalamud.Game.ClientState
Log.Debug("Is login");
this.lastConditionNone = false;
this.IsLoggedIn = true;
this.Login?.Raise(this, null);
this.Login?.InvokeSafely(this, null);
gameGui.ResetUiHideState();
}
@ -181,7 +181,7 @@ namespace Dalamud.Game.ClientState
Log.Debug("Is logout");
this.lastConditionNone = true;
this.IsLoggedIn = false;
this.Logout?.Raise(this, null);
this.Logout?.InvokeSafely(this, null);
gameGui.ResetUiHideState();
}
@ -194,11 +194,11 @@ namespace Dalamud.Game.ClientState
if (this.IsPvP)
{
this.EnterPvP?.Raise();
this.EnterPvP?.InvokeSafely();
}
else
{
this.LeavePvP?.Raise();
this.LeavePvP?.InvokeSafely();
}
}
}

View file

@ -415,7 +415,7 @@ namespace Dalamud.Game
}
else
{
this.Update?.Raise(this);
this.Update?.InvokeSafely(this);
}
}

View file

@ -466,7 +466,7 @@ namespace Dalamud.Game.Gui
var itemId = (ulong)Marshal.ReadInt32(hoverState, 0x138);
this.HoveredItem = itemId;
this.HoveredItemChanged?.Raise(this, itemId);
this.HoveredItemChanged?.InvokeSafely(this, itemId);
Log.Verbose("HoverItemId:{0} this:{1}", itemId, hoverState.ToInt64().ToString("X"));
}
@ -508,7 +508,7 @@ namespace Dalamud.Game.Gui
this.HoveredAction.ActionKind = actionKind;
this.HoveredAction.BaseActionID = actionId;
this.HoveredAction.ActionID = (uint)Marshal.ReadInt32(hoverState, 0x3C);
this.HoveredActionChanged?.Raise(this, this.HoveredAction);
this.HoveredActionChanged?.InvokeSafely(this, this.HoveredAction);
Log.Verbose("HoverActionId: {0}/{1} this:{2}", actionKind, actionId, hoverState.ToInt64().ToString("X"));
}
@ -548,7 +548,7 @@ namespace Dalamud.Game.Gui
// TODO(goat): We should read this from memory directly, instead of relying on catching every toggle.
this.GameUiHidden = !this.GameUiHidden;
this.UiHideToggled?.Raise(this, this.GameUiHidden);
this.UiHideToggled?.InvokeSafely(this, this.GameUiHidden);
Log.Debug("UiHide toggled: {0}", this.GameUiHidden);

View file

@ -288,7 +288,7 @@ namespace Dalamud.Game.Network.Internal
Service<ChatGui>.GetNullable()?.Print($"Duty pop: {cfcName}");
}
this.CfPop?.Raise(this, cfCondition);
this.CfPop?.InvokeSafely(this, cfCondition);
}).ContinueWith((task) => Log.Error(task.Exception, "CfPop.Invoke failed."), TaskContinuationOptions.OnlyOnFaulted);
}
}

View file

@ -773,7 +773,7 @@ namespace Dalamud.Interface.Internal
var customFontFirstConfigIndex = ioFonts.ConfigData.Size;
Log.Verbose("[FONT] Invoke OnBuildFonts");
this.BuildFonts?.Raise();
this.BuildFonts?.InvokeSafely();
Log.Verbose("[FONT] OnBuildFonts OK!");
for (int i = customFontFirstConfigIndex, i_ = ioFonts.ConfigData.Size; i < i_; i++)
@ -881,7 +881,7 @@ namespace Dalamud.Interface.Internal
}
Log.Verbose("[FONT] Invoke OnAfterBuildFonts");
this.AfterBuildFonts?.Raise();
this.AfterBuildFonts?.InvokeSafely();
Log.Verbose("[FONT] OnAfterBuildFonts OK!");
if (ioFonts.Fonts[0].NativePtr != DefaultFont.NativePtr)
@ -978,7 +978,7 @@ namespace Dalamud.Interface.Internal
Log.Verbose($"Calling resizebuffers swap@{swapChain.ToInt64():X}{bufferCount} {width} {height} {newFormat} {swapChainFlags}");
#endif
this.ResizeBuffers?.Raise();
this.ResizeBuffers?.InvokeSafely();
// We have to ensure we're working with the main swapchain,
// as viewports might be resizing as well

View file

@ -393,7 +393,7 @@ namespace Dalamud.Interface
/// </summary>
internal void OpenConfig()
{
this.OpenConfigUi?.Raise();
this.OpenConfigUi?.InvokeSafely();
}
/// <summary>
@ -401,7 +401,7 @@ namespace Dalamud.Interface
/// </summary>
internal void NotifyHideUi()
{
this.HideUi?.Raise();
this.HideUi?.InvokeSafely();
}
/// <summary>
@ -409,7 +409,7 @@ namespace Dalamud.Interface
/// </summary>
internal void NotifyShowUi()
{
this.ShowUi?.Raise();
this.ShowUi?.InvokeSafely();
}
private void OnDraw()
@ -429,7 +429,7 @@ namespace Dalamud.Interface
if (!this.lastFrameUiHideState)
{
this.lastFrameUiHideState = true;
this.HideUi?.Raise();
this.HideUi?.InvokeSafely();
}
return;
@ -438,7 +438,7 @@ namespace Dalamud.Interface
if (this.lastFrameUiHideState)
{
this.lastFrameUiHideState = false;
this.ShowUi?.Raise();
this.ShowUi?.InvokeSafely();
}
if (!this.interfaceManager.FontsReady)
@ -471,7 +471,7 @@ namespace Dalamud.Interface
try
{
this.Draw?.Raise();
this.Draw?.InvokeSafely();
}
catch (Exception ex)
{
@ -504,17 +504,17 @@ namespace Dalamud.Interface
private void OnBuildFonts()
{
this.BuildFonts?.Raise();
this.BuildFonts?.InvokeSafely();
}
private void OnAfterBuildFonts()
{
this.AfterBuildFonts?.Raise();
this.AfterBuildFonts?.InvokeSafely();
}
private void OnResizeBuffers()
{
this.ResizeBuffers?.Raise();
this.ResizeBuffers?.InvokeSafely();
}
}
}

View file

@ -1262,14 +1262,14 @@ internal partial class PluginManager : IDisposable, IServiceType
{
this.DetectAvailablePluginUpdates();
this.OnAvailablePluginsChanged?.Raise();
this.OnAvailablePluginsChanged?.InvokeSafely();
}
private void NotifyInstalledPluginsChanged()
{
this.DetectAvailablePluginUpdates();
this.OnInstalledPluginsChanged?.Raise();
this.OnInstalledPluginsChanged?.InvokeSafely();
}
private static class Locs

View file

@ -20,14 +20,14 @@ namespace Dalamud.Utility
/// <param name="eh">The EventHandler in question.</param>
/// <param name="sender">Default sender for Invoke equivalent.</param>
/// <param name="e">Default EventArgs for Invoke equivalent.</param>
public static void Raise(this EventHandler eh, object sender, EventArgs e)
public static void InvokeSafely(this EventHandler eh, object sender, EventArgs e)
{
if (eh == null)
return;
foreach (var handler in eh.GetInvocationList().Cast<EventHandler>())
{
HandleRaise(() => handler(sender, e));
HandleInvoke(() => handler(sender, e));
}
}
@ -39,14 +39,14 @@ namespace Dalamud.Utility
/// <param name="sender">Default sender for Invoke equivalent.</param>
/// <param name="e">Default EventArgs for Invoke equivalent.</param>
/// <typeparam name="T">Type of EventArgs.</typeparam>
public static void Raise<T>(this EventHandler<T> eh, object sender, T e)
public static void InvokeSafely<T>(this EventHandler<T> eh, object sender, T e)
{
if (eh == null)
return;
foreach (var handler in eh.GetInvocationList().Cast<EventHandler<T>>())
{
HandleRaise(() => handler(sender, e));
HandleInvoke(() => handler(sender, e));
}
}
@ -55,14 +55,14 @@ namespace Dalamud.Utility
/// of a thrown Exception inside of an invocation.
/// </summary>
/// <param name="act">The Action in question.</param>
public static void Raise(this Action act)
public static void InvokeSafely(this Action act)
{
if (act == null)
return;
foreach (var action in act.GetInvocationList().Cast<Action>())
{
HandleRaise(action);
HandleInvoke(action);
}
}
@ -72,18 +72,18 @@ namespace Dalamud.Utility
/// </summary>
/// <param name="updateDelegate">The OnUpdateDelegate in question.</param>
/// <param name="framework">Framework to be passed on to OnUpdateDelegate.</param>
public static void Raise(this OnUpdateDelegate updateDelegate, Framework framework)
public static void InvokeSafely(this OnUpdateDelegate updateDelegate, Framework framework)
{
if (updateDelegate == null)
return;
foreach (var action in updateDelegate.GetInvocationList().Cast<OnUpdateDelegate>())
{
HandleRaise(() => action(framework));
HandleInvoke(() => action(framework));
}
}
private static void HandleRaise(Action act)
private static void HandleInvoke(Action act)
{
try
{