Skip to content

immcrab/Lasting-Utilla

Ownership not verified 1
Open on GitHub

Viewing main at commit a6a25ac430“Add files via upload”· 11 months ago

47 lines · 1.2 KBRaw on GitHub
// Decompiled with JetBrains decompiler
// Type: Utilla.EventHandlerExtensions
// Assembly: Utilla, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: FDD08D98-E155-49FA-85BC-1930928C3BAA
// Assembly location: C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\plugins\Utilla\Utilla.dll

using System;
using UnityEngine;

#nullable disable
namespace Utilla;

public static class EventHandlerExtensions
{
  public static void SafeInvoke(this EventHandler handler, object sender, EventArgs e)
  {
    foreach (EventHandler invocation in handler?.GetInvocationList())
    {
      try
      {
        if (invocation != null)
          invocation(sender, e);
      }
      catch (Exception ex)
      {
        Debug.LogError((object) ex);
      }
    }
  }

  public static void SafeInvoke<T>(this EventHandler<T> handler, object sender, T e) where T : EventArgs
  {
    foreach (EventHandler<T> invocation in handler?.GetInvocationList())
    {
      try
      {
        if (invocation != null)
          invocation(sender, e);
      }
      catch (Exception ex)
      {
        Debug.LogError((object) ex);
      }
    }
  }
}

Code is shown from GitHub as-is. Linking a repository doesn’t prove that a release file on Canopy was built from it.