From 5bb6d85a72af021d9740c24bf2da7b230c3d48c3 Mon Sep 17 00:00:00 2001 From: andruzzzhka Date: Tue, 15 May 2018 22:01:19 +0700 Subject: [PATCH 1/4] Copying plugins to .cache on launch, so mod gui can update original plugin files in-game --- IllusionInjector/PluginManager.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/IllusionInjector/PluginManager.cs b/IllusionInjector/PluginManager.cs index 4cb5d3a5..b44d6733 100644 --- a/IllusionInjector/PluginManager.cs +++ b/IllusionInjector/PluginManager.cs @@ -44,13 +44,28 @@ namespace IllusionInjector _Plugins = new List(); 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"); - 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 debugLogger.Log($"Running on Unity {UnityEngine.Application.unityVersion}"); From ef99a820513cd953da303e67021a1fb1a082949a Mon Sep 17 00:00:00 2001 From: andruzzzhka Date: Tue, 15 May 2018 22:28:31 +0700 Subject: [PATCH 2/4] Added IPluginNew --- IllusionPlugin/IllusionPlugin.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/IllusionPlugin/IllusionPlugin.csproj b/IllusionPlugin/IllusionPlugin.csproj index ae6ce0cf..b2004142 100644 --- a/IllusionPlugin/IllusionPlugin.csproj +++ b/IllusionPlugin/IllusionPlugin.csproj @@ -44,6 +44,7 @@ + From 139c9c585dfa1a4fda6a0b1ef1578f2bdf06bb9b Mon Sep 17 00:00:00 2001 From: artman41 Date: Tue, 15 May 2018 16:40:06 +0100 Subject: [PATCH 3/4] update to reflect changes in logging --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c7bd0291..2a147d3c 100644 --- a/README.md +++ b/README.md @@ -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 From 5ab89833484e882f9e1d2dceeae5d6009e7f3581 Mon Sep 17 00:00:00 2001 From: andruzzzhka Date: Wed, 16 May 2018 19:02:04 +0700 Subject: [PATCH 4/4] Fixed plugins that referenced other plugins (like BeatSaverDownloader) --- IllusionInjector/PluginManager.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/IllusionInjector/PluginManager.cs b/IllusionInjector/PluginManager.cs index 4d5e8b38..de9fb691 100644 --- a/IllusionInjector/PluginManager.cs +++ b/IllusionInjector/PluginManager.cs @@ -57,13 +57,20 @@ namespace IllusionInjector } } - String[] files = Directory.GetFiles(pluginDirectory, "*.dll"); - foreach (string s in files) + //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); - _Plugins.AddRange(LoadPluginsFromFile(pluginCopy, exeName)); + } + + //Load copied plugins + string copiedPluginsDirectory = pluginDirectory + "\\.cache"; + string[] copiedPlugins = Directory.GetFiles(copiedPluginsDirectory, "*.dll"); + foreach (string s in copiedPlugins) + { + _Plugins.AddRange(LoadPluginsFromFile(s, exeName)); }