From 913a87a6955b939c04a4943c0aa9904406df01f0 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 5d484618a81c2caa0ba7f3608b0d5031d45c61d3 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 cfa64968e0dab66df6b0f7a1a2a910d465f886e4 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 4b2afc2e5fccabed97becb6976bda9a590e2f652 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)); }