Esempio n. 1
0
 public IDalamudPlugin GetOrchestrionPlugin()
 {
     try
     {
         var flags    = BindingFlags.NonPublic | BindingFlags.Instance;
         var d        = (Dalamud.Dalamud)_pi.GetType().GetField("dalamud", flags).GetValue(_pi);
         var pmanager = d.GetType().GetProperty("PluginManager", flags).GetValue(d);
         var plugins  =
             (List <(IDalamudPlugin Plugin, PluginDefinition Definition, DalamudPluginInterface PluginInterface, bool IsRaw)>)
             pmanager.GetType().GetProperty("Plugins").GetValue(pmanager);
         WriteLog("Found plugins: " + plugins.Count);
         foreach (var p in plugins)
         {
             if (p.Plugin.Name == "Orchestrion plugin")
             {
                 var porch = p.Plugin;
                 WriteLog("Found Orchestrion plugin.");
                 return(porch);
             }
         }
         return(null);
     }
     catch (Exception e)
     {
         WriteLog("Can't find orchestrion plugin: " + e.Message);
         WriteLog(e.StackTrace);
         return(null);
     }
 }