Browse Source

Added recursive plugin loading

Can be controlled through the config
pull/44/head
Auros 4 years ago
parent
commit
5dbb884417
2 changed files with 18 additions and 1 deletions
  1. +2
    -0
      IPA.Loader/Config/SelfConfig.cs
  2. +16
    -1
      IPA.Loader/Loader/PluginLoader.cs

+ 2
- 0
IPA.Loader/Config/SelfConfig.cs View File

@ -161,5 +161,7 @@ namespace IPA.Config
public virtual string LastGameVersion { get; set; } = null;
// LINE: ignore
public static string LastGameVersion_ => Instance?.LastGameVersion;
public virtual bool RecursivePluginLoading { get; set; } = false;
}
}

+ 16
- 1
IPA.Loader/Loader/PluginLoader.cs View File

@ -70,9 +70,24 @@ namespace IPA.Loader
private static readonly Regex embeddedTextDescriptionPattern = new Regex(@"#!\[(.+)\]", RegexOptions.Compiled | RegexOptions.Singleline);
internal static List<string> FindPluginsRecursively(string directory)
{
List<string> dirs = new List<string>();
foreach (var dir in Directory.GetDirectories(directory))
{
dirs.AddRange(FindPluginsRecursively(dir));
}
foreach (var file in Directory.GetFiles(directory, "*.dll"))
{
dirs.Add(file);
}
return dirs;
}
internal static void LoadMetadata()
{
string[] plugins = Directory.GetFiles(UnityGame.PluginsPath, "*.dll");
string[] plugins = !SelfConfig.Instance.RecursivePluginLoading ? Directory.GetFiles(UnityGame.PluginsPath, "*.dll") : FindPluginsRecursively(UnityGame.PluginsPath).ToArray();
try
{


Loading…
Cancel
Save