Browse Source

Copying plugins to .cache on launch, so mod gui can update original plugin files in-game

pull/46/head
andruzzzhka 6 years ago
parent
commit
913a87a695
1 changed files with 19 additions and 4 deletions
  1. +19
    -4
      IllusionInjector/PluginManager.cs

+ 19
- 4
IllusionInjector/PluginManager.cs View File

@ -44,13 +44,28 @@ namespace IllusionInjector
_Plugins = new List<IPlugin>(); _Plugins = new List<IPlugin>();
if (!Directory.Exists(pluginDirectory)) return; if (!Directory.Exists(pluginDirectory)) return;
if (!Directory.Exists(Path.Combine(pluginDirectory, ".cache")))
{
Directory.CreateDirectory(Path.Combine(pluginDirectory, ".cache"));
}
else
{
foreach (string plugin in Directory.GetFiles(Path.Combine(pluginDirectory, ".cache"), "*"))
{
File.Delete(plugin);
}
}
String[] files = Directory.GetFiles(pluginDirectory, "*.dll"); String[] files = Directory.GetFiles(pluginDirectory, "*.dll");
foreach (var s in files)
foreach (string s in files)
{ {
_Plugins.AddRange(LoadPluginsFromFile(Path.Combine(pluginDirectory, s), exeName));
string pluginCopy = pluginDirectory + "\\.cache" + s.Substring(s.LastIndexOf('\\'));
File.Copy(Path.Combine(pluginDirectory, s), pluginCopy);
_Plugins.AddRange(LoadPluginsFromFile(pluginCopy, exeName));
} }
// DEBUG // DEBUG
debugLogger.Log($"Running on Unity {UnityEngine.Application.unityVersion}"); debugLogger.Log($"Running on Unity {UnityEngine.Application.unityVersion}");


Loading…
Cancel
Save