Browse Source

Merge remote-tracking branch 'origin/master'

pull/46/head
artman41 6 years ago
parent
commit
e6346b4a11
3 changed files with 31 additions and 6 deletions
  1. +27
    -5
      IllusionInjector/PluginManager.cs
  2. +1
    -0
      IllusionPlugin/IllusionPlugin.csproj
  3. +3
    -1
      README.md

+ 27
- 5
IllusionInjector/PluginManager.cs View File

@ -44,13 +44,35 @@ namespace IllusionInjector
_Plugins = new List<IPlugin>();
if (!Directory.Exists(pluginDirectory)) return;
String[] files = Directory.GetFiles(pluginDirectory, "*.dll");
foreach (var s in files)
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);
}
}
//Copy plugins to .cache
string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll");
foreach (string s in originalPlugins)
{
string pluginCopy = pluginDirectory + "\\.cache" + s.Substring(s.LastIndexOf('\\'));
File.Copy(Path.Combine(pluginDirectory, s), pluginCopy);
}
//Load copied plugins
string copiedPluginsDirectory = pluginDirectory + "\\.cache";
string[] copiedPlugins = Directory.GetFiles(copiedPluginsDirectory, "*.dll");
foreach (string s in copiedPlugins)
{
_Plugins.AddRange(LoadPluginsFromFile(Path.Combine(pluginDirectory, s), exeName));
_Plugins.AddRange(LoadPluginsFromFile(s, exeName));
}
// DEBUG
debugLogger.Log($"Running on Unity {UnityEngine.Application.unityVersion}");


+ 1
- 0
IllusionPlugin/IllusionPlugin.csproj View File

@ -44,6 +44,7 @@
<Compile Include="IEnhancedPlugin.cs" />
<Compile Include="IniFile.cs" />
<Compile Include="IPlugin.cs" />
<Compile Include="IPluginNew.cs" />
<Compile Include="Logger.cs" />
<Compile Include="ModPrefs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />


+ 3
- 1
README.md View File

@ -24,7 +24,9 @@ To verify it worked, start the game with the `--verbose` flag. If a new console
3. Implement `IPlugin` or `IEnhancedPlugin`
4. Build the project and copy the DLL into the Plugins folder of the game
Note: You can use `Console.Write()` with the `--verbose` flag for debugging your plugins.
Note: You can use the `Logger` class to debug your plugins. Either retrieve an instance using `this.GetLogger()` in your Plugin class or use `new Logger("Mod Name")`.
Use the `--verbose` flag to access the console.
## How To Keep The Game Patched


Loading…
Cancel
Save