From b1ea2e387b12fe433d7da9fd71b1d35ce5d08e76 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sat, 1 Sep 2018 16:44:15 -0500 Subject: [PATCH] Reworked some refactor organization Added somewhaat backwards compatavbility through Mono.Cecil --- IPA.Loader/IPA.Loader.csproj | 34 +++++++++---------- .../BeatSaber/CompositeBSPlugin.cs | 0 .../IPA/CompositeIPAPlugin.cs | 0 .../Logging/Printers/ColoredConsolePrinter.cs | 0 .../Logging/Printers/GZFilePrinter.cs | 0 .../Logging/Printers/GlobalLogFilePrinter.cs | 0 .../Logging/Printers/PluginLogFilePrinter.cs | 0 .../Logging/StandardLogger.cs | 0 .../Logging/UnityLogInterceptor.cs | 0 .../{ => IllusionInjector}/PluginComponent.cs | 0 .../{ => IllusionInjector}/PluginManager.cs | 13 +++++++ .../Updating/ModsaberML/ApiEndpoint.cs | 0 .../Updating/ModsaberML/Updater.cs | 0 .../Updating/SelfPlugin.cs | 0 .../Utilities/Extensions.cs | 0 .../Utilities/LoneFunctions.cs | 0 .../Utilities/SteamCheck.cs | 0 17 files changed, 30 insertions(+), 17 deletions(-) rename IPA.Loader/{ => IllusionInjector}/BeatSaber/CompositeBSPlugin.cs (100%) rename IPA.Loader/{ => IllusionInjector}/IPA/CompositeIPAPlugin.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Logging/Printers/ColoredConsolePrinter.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Logging/Printers/GZFilePrinter.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Logging/Printers/GlobalLogFilePrinter.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Logging/Printers/PluginLogFilePrinter.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Logging/StandardLogger.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Logging/UnityLogInterceptor.cs (100%) rename IPA.Loader/{ => IllusionInjector}/PluginComponent.cs (100%) rename IPA.Loader/{ => IllusionInjector}/PluginManager.cs (95%) rename IPA.Loader/{ => IllusionInjector}/Updating/ModsaberML/ApiEndpoint.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Updating/ModsaberML/Updater.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Updating/SelfPlugin.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Utilities/Extensions.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Utilities/LoneFunctions.cs (100%) rename IPA.Loader/{ => IllusionInjector}/Utilities/SteamCheck.cs (100%) diff --git a/IPA.Loader/IPA.Loader.csproj b/IPA.Loader/IPA.Loader.csproj index af6be3af..2d0184ad 100644 --- a/IPA.Loader/IPA.Loader.csproj +++ b/IPA.Loader/IPA.Loader.csproj @@ -51,7 +51,7 @@ - + @@ -63,23 +63,23 @@ - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + diff --git a/IPA.Loader/BeatSaber/CompositeBSPlugin.cs b/IPA.Loader/IllusionInjector/BeatSaber/CompositeBSPlugin.cs similarity index 100% rename from IPA.Loader/BeatSaber/CompositeBSPlugin.cs rename to IPA.Loader/IllusionInjector/BeatSaber/CompositeBSPlugin.cs diff --git a/IPA.Loader/IPA/CompositeIPAPlugin.cs b/IPA.Loader/IllusionInjector/IPA/CompositeIPAPlugin.cs similarity index 100% rename from IPA.Loader/IPA/CompositeIPAPlugin.cs rename to IPA.Loader/IllusionInjector/IPA/CompositeIPAPlugin.cs diff --git a/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs b/IPA.Loader/IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs similarity index 100% rename from IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs rename to IPA.Loader/IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs diff --git a/IPA.Loader/Logging/Printers/GZFilePrinter.cs b/IPA.Loader/IllusionInjector/Logging/Printers/GZFilePrinter.cs similarity index 100% rename from IPA.Loader/Logging/Printers/GZFilePrinter.cs rename to IPA.Loader/IllusionInjector/Logging/Printers/GZFilePrinter.cs diff --git a/IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs b/IPA.Loader/IllusionInjector/Logging/Printers/GlobalLogFilePrinter.cs similarity index 100% rename from IPA.Loader/Logging/Printers/GlobalLogFilePrinter.cs rename to IPA.Loader/IllusionInjector/Logging/Printers/GlobalLogFilePrinter.cs diff --git a/IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs b/IPA.Loader/IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs similarity index 100% rename from IPA.Loader/Logging/Printers/PluginLogFilePrinter.cs rename to IPA.Loader/IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs diff --git a/IPA.Loader/Logging/StandardLogger.cs b/IPA.Loader/IllusionInjector/Logging/StandardLogger.cs similarity index 100% rename from IPA.Loader/Logging/StandardLogger.cs rename to IPA.Loader/IllusionInjector/Logging/StandardLogger.cs diff --git a/IPA.Loader/Logging/UnityLogInterceptor.cs b/IPA.Loader/IllusionInjector/Logging/UnityLogInterceptor.cs similarity index 100% rename from IPA.Loader/Logging/UnityLogInterceptor.cs rename to IPA.Loader/IllusionInjector/Logging/UnityLogInterceptor.cs diff --git a/IPA.Loader/PluginComponent.cs b/IPA.Loader/IllusionInjector/PluginComponent.cs similarity index 100% rename from IPA.Loader/PluginComponent.cs rename to IPA.Loader/IllusionInjector/PluginComponent.cs diff --git a/IPA.Loader/PluginManager.cs b/IPA.Loader/IllusionInjector/PluginManager.cs similarity index 95% rename from IPA.Loader/PluginManager.cs rename to IPA.Loader/IllusionInjector/PluginManager.cs index 14c67222..c872e84c 100644 --- a/IPA.Loader/PluginManager.cs +++ b/IPA.Loader/IllusionInjector/PluginManager.cs @@ -3,6 +3,7 @@ using IllusionInjector.Updating; using IllusionInjector.Utilities; using IllusionPlugin; using IllusionPlugin.BeatSaber; +using Mono.Cecil; using System; using System.Collections.Generic; using System.Diagnostics; @@ -176,6 +177,18 @@ namespace IllusionInjector try { + var module = ModuleDefinition.ReadModule(file); + bool modifiedModule = false; + foreach (var @ref in module.AssemblyReferences) + { + if (@ref.Name == "IllusionPlugin" || @ref.Name == "IllusionInjector") + { + @ref.Name = "IPA.Loader"; + modifiedModule = true; + } + } + if (modifiedModule) module.Write(file); + Assembly assembly = Assembly.LoadFrom(file); foreach (Type t in assembly.GetTypes()) diff --git a/IPA.Loader/Updating/ModsaberML/ApiEndpoint.cs b/IPA.Loader/IllusionInjector/Updating/ModsaberML/ApiEndpoint.cs similarity index 100% rename from IPA.Loader/Updating/ModsaberML/ApiEndpoint.cs rename to IPA.Loader/IllusionInjector/Updating/ModsaberML/ApiEndpoint.cs diff --git a/IPA.Loader/Updating/ModsaberML/Updater.cs b/IPA.Loader/IllusionInjector/Updating/ModsaberML/Updater.cs similarity index 100% rename from IPA.Loader/Updating/ModsaberML/Updater.cs rename to IPA.Loader/IllusionInjector/Updating/ModsaberML/Updater.cs diff --git a/IPA.Loader/Updating/SelfPlugin.cs b/IPA.Loader/IllusionInjector/Updating/SelfPlugin.cs similarity index 100% rename from IPA.Loader/Updating/SelfPlugin.cs rename to IPA.Loader/IllusionInjector/Updating/SelfPlugin.cs diff --git a/IPA.Loader/Utilities/Extensions.cs b/IPA.Loader/IllusionInjector/Utilities/Extensions.cs similarity index 100% rename from IPA.Loader/Utilities/Extensions.cs rename to IPA.Loader/IllusionInjector/Utilities/Extensions.cs diff --git a/IPA.Loader/Utilities/LoneFunctions.cs b/IPA.Loader/IllusionInjector/Utilities/LoneFunctions.cs similarity index 100% rename from IPA.Loader/Utilities/LoneFunctions.cs rename to IPA.Loader/IllusionInjector/Utilities/LoneFunctions.cs diff --git a/IPA.Loader/Utilities/SteamCheck.cs b/IPA.Loader/IllusionInjector/Utilities/SteamCheck.cs similarity index 100% rename from IPA.Loader/Utilities/SteamCheck.cs rename to IPA.Loader/IllusionInjector/Utilities/SteamCheck.cs