Browse Source

Ignore non-constructable plugins

pull/11/head
Quit 6 years ago
parent
commit
f8b3d8df51
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      IllusionInjector/PluginManager.cs

+ 10
- 2
IllusionInjector/PluginManager.cs View File

@@ -48,7 +48,7 @@ namespace IllusionInjector
{
_Plugins.AddRange(LoadPluginsFromFile(Path.Combine(pluginDirectory, s), exeName));
}

// DEBUG
Console.WriteLine("Running on Unity {0}", UnityEngine.Application.unityVersion);
@@ -76,7 +76,7 @@ namespace IllusionInjector

foreach (Type t in assembly.GetTypes())
{
if (t.GetInterface("IPlugin") != null)
if (IsValidPlugin(t))
{
try
{
@@ -108,6 +108,14 @@ namespace IllusionInjector
return plugins;
}

private static bool IsValidPlugin(Type type)
{
return type.GetInterface("IPlugin") != null
&& !type.IsAbstract
&& !type.IsInterface
&& type.GetConstructor(Type.EmptyTypes) != null;
}

public class AppInfo
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false)]


Loading…
Cancel
Save