diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericEventFinder.cs b/src/StardewModdingAPI.AssemblyRewriters/Finders/EventFinder.cs similarity index 93% rename from src/StardewModdingAPI.AssemblyRewriters/Finders/GenericEventFinder.cs rename to src/StardewModdingAPI.AssemblyRewriters/Finders/EventFinder.cs index c2a981e5..359ca63e 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericEventFinder.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Finders/EventFinder.cs @@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework; namespace StardewModdingAPI.AssemblyRewriters.Finders { /// Finds CIL instructions that reference a given event. - public sealed class GenericEventFinder : BaseMethodFinder + public sealed class EventFinder : BaseMethodFinder { /********* ** Properties @@ -30,7 +30,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders /// Construct an instance. /// The full type name for which to find references. /// The event name for which to find references. - public GenericEventFinder(string fullTypeName, string eventName) + public EventFinder(string fullTypeName, string eventName) { this.FullTypeName = fullTypeName; this.EventName = eventName; diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericFieldFinder.cs b/src/StardewModdingAPI.AssemblyRewriters/Finders/FieldFinder.cs similarity index 93% rename from src/StardewModdingAPI.AssemblyRewriters/Finders/GenericFieldFinder.cs rename to src/StardewModdingAPI.AssemblyRewriters/Finders/FieldFinder.cs index 056422a4..516641f2 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericFieldFinder.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Finders/FieldFinder.cs @@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework; namespace StardewModdingAPI.AssemblyRewriters.Finders { /// Finds CIL instructions that reference a given field. - public sealed class GenericFieldFinder : BaseFieldFinder + public sealed class FieldFinder : BaseFieldFinder { /********* ** Properties @@ -34,7 +34,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders /// The full type name for which to find references. /// The field name for which to find references. /// Whether the field to match is static. - public GenericFieldFinder(string fullTypeName, string fieldName, bool isStatic) + public FieldFinder(string fullTypeName, string fieldName, bool isStatic) { this.FullTypeName = fullTypeName; this.FieldName = fieldName; diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericMethodFinder.cs b/src/StardewModdingAPI.AssemblyRewriters/Finders/MethodFinder.cs similarity index 93% rename from src/StardewModdingAPI.AssemblyRewriters/Finders/GenericMethodFinder.cs rename to src/StardewModdingAPI.AssemblyRewriters/Finders/MethodFinder.cs index f5443558..6c210d68 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericMethodFinder.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Finders/MethodFinder.cs @@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework; namespace StardewModdingAPI.AssemblyRewriters.Finders { /// Finds CIL instructions that reference a given method. - public sealed class GenericMethodFinder : BaseMethodFinder + public sealed class MethodFinder : BaseMethodFinder { /********* ** Properties @@ -30,7 +30,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders /// Construct an instance. /// The full type name for which to find references. /// The method name for which to find references. - public GenericMethodFinder(string fullTypeName, string methodName) + public MethodFinder(string fullTypeName, string methodName) { this.FullTypeName = fullTypeName; this.MethodName = methodName; diff --git a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericTypeFinder.cs b/src/StardewModdingAPI.AssemblyRewriters/Finders/TypeFinder.cs similarity index 95% rename from src/StardewModdingAPI.AssemblyRewriters/Finders/GenericTypeFinder.cs rename to src/StardewModdingAPI.AssemblyRewriters/Finders/TypeFinder.cs index 1556cc3c..ba8e7102 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Finders/GenericTypeFinder.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Finders/TypeFinder.cs @@ -5,7 +5,7 @@ using Mono.Cecil.Cil; namespace StardewModdingAPI.AssemblyRewriters.Finders { /// Finds CIL instructions that reference a given type. - public sealed class GenericTypeFinder : IInstructionFinder + public sealed class TypeFinder : IInstructionFinder { /********* ** Accessors @@ -26,7 +26,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders *********/ /// Construct an instance. /// The full type name to match. - public GenericTypeFinder(string fullTypeName) + public TypeFinder(string fullTypeName) { this.FullTypeName = fullTypeName; this.NounPhrase = $"obsolete {fullTypeName} type"; diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/GenericFieldToPropertyRewriter.cs b/src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldToPropertyRewriter.cs similarity index 94% rename from src/StardewModdingAPI.AssemblyRewriters/Rewriters/GenericFieldToPropertyRewriter.cs rename to src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldToPropertyRewriter.cs index f58bcfbb..caf0a16c 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/GenericFieldToPropertyRewriter.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Rewriters/FieldToPropertyRewriter.cs @@ -6,7 +6,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework; namespace StardewModdingAPI.AssemblyRewriters.Rewriters { /// Rewrites field references into property references. - public class GenericFieldToPropertyRewriter : BaseFieldRewriter + public class FieldToPropertyRewriter : BaseFieldRewriter { /********* ** Properties @@ -32,7 +32,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Rewriters /// The type whose field to which references should be rewritten. /// The field name to rewrite. /// A brief noun phrase indicating what the instruction finder matches (or null to generate one). - public GenericFieldToPropertyRewriter(Type type, string fieldName, string nounPhrase = null) + public FieldToPropertyRewriter(Type type, string fieldName, string nounPhrase = null) { this.Type = type; this.FieldName = fieldName; diff --git a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/GenericMethodMapper.cs b/src/StardewModdingAPI.AssemblyRewriters/Rewriters/MethodParentRewriter.cs similarity index 94% rename from src/StardewModdingAPI.AssemblyRewriters/Rewriters/GenericMethodMapper.cs rename to src/StardewModdingAPI.AssemblyRewriters/Rewriters/MethodParentRewriter.cs index 49e0aad7..9c19f473 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Rewriters/GenericMethodMapper.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Rewriters/MethodParentRewriter.cs @@ -6,7 +6,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework; namespace StardewModdingAPI.AssemblyRewriters.Rewriters { /// Rewrites method references from one parent type to another if the signatures match. - public class GenericMethodMapper : BaseMethodRewriter + public class MethodParentRewriter : BaseMethodRewriter { /********* ** Properties @@ -36,7 +36,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Rewriters /// The type with methods to map to. /// Whether to only rewrite references if loading the assembly on a different platform than it was compiled on. /// A brief noun phrase indicating what the instruction finder matches (or null to generate one). - public GenericMethodMapper(Type fromType, Type toType, bool onlyIfPlatformChanged = false, string nounPhrase = null) + public MethodParentRewriter(Type fromType, Type toType, bool onlyIfPlatformChanged = false, string nounPhrase = null) { this.FromType = fromType; this.ToType = toType; diff --git a/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj b/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj index 8416aad7..90e800d0 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj +++ b/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj @@ -66,22 +66,22 @@ Properties\GlobalAssemblyInfo.cs - - - + + + + + - - + + + - - - - - + + diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs index 1965cae3..5fa25014 100644 --- a/src/StardewModdingAPI/Constants.cs +++ b/src/StardewModdingAPI/Constants.cs @@ -143,27 +143,27 @@ namespace StardewModdingAPI return new IInstructionFinder[] { // changes in Stardew Valley 1.2 (that don't have rewriters) - new GenericFieldFinder("StardewValley.Game1", "borderFont", isStatic: true), - new GenericFieldFinder("StardewValley.Game1", "smoothFont", isStatic: true), - new GenericFieldFinder("StardewValley.Item", "set_Name", isStatic: false), + new FieldFinder("StardewValley.Game1", "borderFont", isStatic: true), + new FieldFinder("StardewValley.Game1", "smoothFont", isStatic: true), + new FieldFinder("StardewValley.Item", "set_Name", isStatic: false), // APIs removed in SMAPI 1.9 - new GenericTypeFinder("StardewModdingAPI.Advanced.ConfigFile"), - new GenericTypeFinder("StardewModdingAPI.Advanced.IConfigFile"), - new GenericTypeFinder("StardewModdingAPI.Entities.SPlayer"), - new GenericTypeFinder("StardewModdingAPI.Extensions"), - new GenericTypeFinder("StardewModdingAPI.Inheritance.ItemStackChange"), - new GenericTypeFinder("StardewModdingAPI.Inheritance.SGame"), - new GenericTypeFinder("StardewModdingAPI.Inheritance.SObject"), - new GenericTypeFinder("StardewModdingAPI.LogWriter"), - new GenericTypeFinder("StardewModdingAPI.Manifest"), - new GenericTypeFinder("StardewModdingAPI.Version"), - new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawDebug"), - new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawTick"), - new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderHudEventNoCheck"), - new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderGuiEventNoCheck"), - new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderHudEventNoCheck"), - new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck") + new TypeFinder("StardewModdingAPI.Advanced.ConfigFile"), + new TypeFinder("StardewModdingAPI.Advanced.IConfigFile"), + new TypeFinder("StardewModdingAPI.Entities.SPlayer"), + new TypeFinder("StardewModdingAPI.Extensions"), + new TypeFinder("StardewModdingAPI.Inheritance.ItemStackChange"), + new TypeFinder("StardewModdingAPI.Inheritance.SGame"), + new TypeFinder("StardewModdingAPI.Inheritance.SObject"), + new TypeFinder("StardewModdingAPI.LogWriter"), + new TypeFinder("StardewModdingAPI.Manifest"), + new TypeFinder("StardewModdingAPI.Version"), + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawDebug"), + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawTick"), + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderHudEventNoCheck"), + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderGuiEventNoCheck"), + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderHudEventNoCheck"), + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck") }; } @@ -173,12 +173,12 @@ namespace StardewModdingAPI return new IInstructionRewriter[] { // crossplatform - new GenericMethodMapper(typeof(SpriteBatch), typeof(SpriteBatchWrapper), onlyIfPlatformChanged: true), + new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchWrapper), onlyIfPlatformChanged: true), // Stardew Valley 1.2 - new GenericFieldToPropertyRewriter(typeof(Game1), nameof(Game1.activeClickableMenu)), - new GenericFieldToPropertyRewriter(typeof(Game1), nameof(Game1.gameMode)), - new GenericFieldToPropertyRewriter(typeof(Game1), nameof(Game1.player)) + new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.activeClickableMenu)), + new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.gameMode)), + new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.player)) }; }