From c513bb011c858e59abbd77f75080f4a1d8b712f9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 19 Sep 2017 22:52:52 -0400 Subject: pass mod metadata into rewriters (#347) --- src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs | 6 ++++-- src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs | 6 ++++-- src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs | 6 ++++-- .../Framework/ModLoading/Finders/PropertyFinder.cs | 6 ++++-- src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src/StardewModdingAPI/Framework/ModLoading/Finders') diff --git a/src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs index ce234e39..ac5034c4 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/EventFinder.cs @@ -38,18 +38,20 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders } /// Rewrite a method definition for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The method definition to rewrite. /// Metadata for mapping assemblies to the current platform. /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) { return false; } /// Rewrite a CIL instruction for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The CIL rewriter. /// The instruction to rewrite. @@ -57,7 +59,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) { if (!this.IsMatch(instruction)) return false; diff --git a/src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs index 2feaf2e6..008399d5 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/FieldFinder.cs @@ -38,18 +38,20 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders } /// Rewrite a method definition for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The method definition to rewrite. /// Metadata for mapping assemblies to the current platform. /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) { return false; } /// Rewrite a CIL instruction for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The CIL rewriter. /// The instruction to rewrite. @@ -57,7 +59,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) { if (!this.IsMatch(instruction)) return false; diff --git a/src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs index c3bb36e3..2a6dc99e 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/MethodFinder.cs @@ -38,18 +38,20 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders } /// Rewrite a method definition for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The method definition to rewrite. /// Metadata for mapping assemblies to the current platform. /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) { return false; } /// Rewrite a CIL instruction for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The CIL rewriter. /// The instruction to rewrite. @@ -57,7 +59,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) + public bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) { if (!this.IsMatch(instruction)) return false; diff --git a/src/StardewModdingAPI/Framework/ModLoading/Finders/PropertyFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/PropertyFinder.cs index d1fed84b..a0ce1cbf 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/Finders/PropertyFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/PropertyFinder.cs @@ -38,18 +38,20 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders } /// Rewrite a method definition for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The method definition to rewrite. /// Metadata for mapping assemblies to the current platform. /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) { return false; } /// Rewrite a CIL instruction for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The CIL rewriter. /// The instruction to rewrite. @@ -57,7 +59,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) { if (!this.IsMatch(instruction)) return false; diff --git a/src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs b/src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs index e67e6766..a3005c85 100644 --- a/src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs +++ b/src/StardewModdingAPI/Framework/ModLoading/Finders/TypeFinder.cs @@ -34,13 +34,14 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders } /// Rewrite a method definition for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The method definition to rewrite. /// Metadata for mapping assemblies to the current platform. /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged) { if (!this.IsMatch(method)) return false; @@ -49,6 +50,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders } /// Rewrite a CIL instruction for compatibility. + /// The mod to which the module belongs. /// The module being rewritten. /// The CIL rewriter. /// The instruction to rewrite. @@ -56,7 +58,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders /// Whether the mod was compiled on a different platform. /// Returns whether the instruction was rewritten. /// The CIL instruction is not compatible, and can't be rewritten. - public virtual bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) + public virtual bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged) { if (!this.IsMatch(instruction)) return false; -- cgit