summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/ModLoading/Rewriters
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-09-19 22:52:52 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-09-19 22:52:52 -0400
commitc513bb011c858e59abbd77f75080f4a1d8b712f9 (patch)
tree1ba22b78c0a0e9d3915fb4d2d6378eff0e1ae532 /src/StardewModdingAPI/Framework/ModLoading/Rewriters
parent954de8c4f2683b39a3f5a11fd29c39130bc31bdb (diff)
downloadSMAPI-c513bb011c858e59abbd77f75080f4a1d8b712f9.tar.gz
SMAPI-c513bb011c858e59abbd77f75080f4a1d8b712f9.tar.bz2
SMAPI-c513bb011c858e59abbd77f75080f4a1d8b712f9.zip
pass mod metadata into rewriters (#347)
Diffstat (limited to 'src/StardewModdingAPI/Framework/ModLoading/Rewriters')
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs3
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldToPropertyRewriter.cs3
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs6
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs6
4 files changed, 12 insertions, 6 deletions
diff --git a/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs
index 7b838f13..fb2a9a96 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs
@@ -33,6 +33,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
}
/// <summary>Rewrite a CIL instruction for compatibility.</summary>
+ /// <param name="mod">The mod to which the module belongs.</param>
/// <param name="module">The module being rewritten.</param>
/// <param name="cil">The CIL rewriter.</param>
/// <param name="instruction">The instruction to rewrite.</param>
@@ -40,7 +41,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
/// <returns>Returns whether the instruction was rewritten.</returns>
/// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- public override bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ public override 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/Rewriters/FieldToPropertyRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldToPropertyRewriter.cs
index 8ef14103..03d1f707 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldToPropertyRewriter.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/FieldToPropertyRewriter.cs
@@ -33,6 +33,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
}
/// <summary>Rewrite a CIL instruction for compatibility.</summary>
+ /// <param name="mod">The mod to which the module belongs.</param>
/// <param name="module">The module being rewritten.</param>
/// <param name="cil">The CIL rewriter.</param>
/// <param name="instruction">The instruction to rewrite.</param>
@@ -40,7 +41,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
/// <returns>Returns whether the instruction was rewritten.</returns>
/// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- public override bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ public override 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/Rewriters/MethodParentRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs
index 1b95b83b..1e116e1f 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs
@@ -44,18 +44,20 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
}
/// <summary>Rewrite a method definition for compatibility.</summary>
+ /// <param name="mod">The mod to which the module belongs.</param>
/// <param name="module">The module being rewritten.</param>
/// <param name="method">The method definition to rewrite.</param>
/// <param name="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
/// <returns>Returns whether the instruction was rewritten.</returns>
/// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- public bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ public bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged)
{
return false;
}
/// <summary>Rewrite a CIL instruction for compatibility.</summary>
+ /// <param name="mod">The mod to which the module belongs.</param>
/// <param name="module">The module being rewritten.</param>
/// <param name="cil">The CIL rewriter.</param>
/// <param name="instruction">The instruction to rewrite.</param>
@@ -63,7 +65,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
/// <returns>Returns whether the instruction was rewritten.</returns>
/// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- 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, platformChanged))
return false;
diff --git a/src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs
index 2c444b64..8db39cfe 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs
@@ -33,13 +33,14 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
}
/// <summary>Rewrite a method definition for compatibility.</summary>
+ /// <param name="mod">The mod to which the module belongs.</param>
/// <param name="module">The module being rewritten.</param>
/// <param name="method">The method definition to rewrite.</param>
/// <param name="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
/// <returns>Returns whether the instruction was rewritten.</returns>
/// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- public override bool Rewrite(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ public override bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged)
{
bool rewritten = false;
@@ -87,6 +88,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
}
/// <summary>Rewrite a CIL instruction for compatibility.</summary>
+ /// <param name="mod">The mod to which the module belongs.</param>
/// <param name="module">The module being rewritten.</param>
/// <param name="cil">The CIL rewriter.</param>
/// <param name="instruction">The instruction to rewrite.</param>
@@ -94,7 +96,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
/// <returns>Returns whether the instruction was rewritten.</returns>
/// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- public override bool Rewrite(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ public override bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
{
if (!this.IsMatch(instruction) && !instruction.ToString().Contains(this.FromTypeName))
return false;