DalamudPython/DalamudPython/Util.cs

15 lines
501 B
C#
Executable File

using System.Reflection;
using Dalamud.Logging;
using Dalamud.Plugin;
namespace DalamudPython {
public static class Util {
public static T GetService<T>() {
PluginLog.Log($"Requesting {typeof(T)}");
var service = typeof(IDalamudPlugin).Assembly.GetType("Dalamud.Service`1")!.MakeGenericType(typeof(T));
var get = service.GetMethod("Get", BindingFlags.Public | BindingFlags.Static)!;
return (T) get.Invoke(null, null)!;
}
}
}