|
|
@ -111,6 +111,46 @@ namespace IPA.Loader |
|
|
|
{ |
|
|
|
string pluginCopy = Path.Combine(cacheDir, Path.GetFileName(s)); |
|
|
|
File.Copy(Path.Combine(pluginDirectory, s), pluginCopy); |
|
|
|
|
|
|
|
#region Fix assemblies for refactor
|
|
|
|
|
|
|
|
var module = ModuleDefinition.ReadModule(Path.Combine(pluginDirectory, s)); |
|
|
|
foreach (var @ref in module.AssemblyReferences) |
|
|
|
{ // fix assembly references
|
|
|
|
if (@ref.Name == "IllusionPlugin" || @ref.Name == "IllusionInjector") |
|
|
|
{ |
|
|
|
@ref.Name = "IPA.Loader"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var @ref in module.GetTypeReferences()) |
|
|
|
{ // fix type references
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IEnhancedPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IBeatSaberPlugin") @ref.Namespace = "IPA"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IEnhancedBeatSaberPlugin") @ref.Namespace = "IPA"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.BeatSaber.ModsaberModInfo") @ref.Namespace = "IPA"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IniFile") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IModPrefs") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.ModPrefs") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.Utils.ReflectionUtil") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.Logging.Logger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.Logging.LogPrinter") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.PluginManager") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.PluginComponent") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.CompositeBSPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.CompositeIPAPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Logging.UnityLogInterceptor") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Logging.StandardLogger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Updating.SelfPlugin") @ref.Namespace = "IPA.Updating"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Updating.Backup.BackupUnit") @ref.Namespace = "IPA.Updating.Backup"; //@ref.Name = "";
|
|
|
|
if (@ref.Namespace == "IllusionInjector.Utilities") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
|
|
|
|
if (@ref.Namespace == "IllusionInjector.Logging.Printers") @ref.Namespace = "IPA.Logging.Printers"; //@ref.Name = "";
|
|
|
|
if (@ref.Namespace == "IllusionInjector.Updating.ModsaberML") @ref.Namespace = "IPA.Updating.ModsaberML"; //@ref.Name = "";
|
|
|
|
} |
|
|
|
module.Write(pluginCopy); |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
var selfPlugin = new BSPluginMeta |
|
|
@ -186,49 +226,6 @@ namespace IPA.Loader |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
#region Fix assemblies for refactor
|
|
|
|
|
|
|
|
var module = ModuleDefinition.ReadModule(file); |
|
|
|
bool modifiedModule = false; |
|
|
|
foreach (var @ref in module.AssemblyReferences) |
|
|
|
{ // fix assembly references
|
|
|
|
if (@ref.Name == "IllusionPlugin" || @ref.Name == "IllusionInjector") |
|
|
|
{ |
|
|
|
@ref.Name = "IPA.Loader"; |
|
|
|
modifiedModule = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (modifiedModule) |
|
|
|
{ // types don't need to be fixed if it's already referencing the new version
|
|
|
|
foreach (var @ref in module.GetTypeReferences()) |
|
|
|
{ // fix type references
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IEnhancedPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IBeatSaberPlugin") @ref.Namespace = "IPA"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IEnhancedBeatSaberPlugin") @ref.Namespace = "IPA"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.BeatSaber.ModsaberModInfo") @ref.Namespace = "IPA"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IniFile") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.IModPrefs") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.ModPrefs") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.Utils.ReflectionUtil") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.Logging.Logger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionPlugin.Logging.LogPrinter") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.PluginManager") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.PluginComponent") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.CompositeBSPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.CompositeIPAPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Logging.UnityLogInterceptor") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Logging.StandardLogger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Updating.SelfPlugin") @ref.Namespace = "IPA.Updating"; //@ref.Name = "";
|
|
|
|
if (@ref.FullName == "IllusionInjector.Updating.Backup.BackupUnit") @ref.Namespace = "IPA.Updating.Backup"; //@ref.Name = "";
|
|
|
|
if (@ref.Namespace == "IllusionInjector.Utilities") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
|
|
|
|
if (@ref.Namespace == "IllusionInjector.Logging.Printers") @ref.Namespace = "IPA.Logging.Printers"; //@ref.Name = "";
|
|
|
|
if (@ref.Namespace == "IllusionInjector.Updating.ModsaberML") @ref.Namespace = "IPA.Updating.ModsaberML"; //@ref.Name = "";
|
|
|
|
} |
|
|
|
module.Write(file); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
Assembly assembly = Assembly.LoadFrom(file); |
|
|
|
|
|
|
|