drop 'generic' prefix for rewriters since they're all generic now
This commit is contained in:
parent
2e58f853d2
commit
4d48bdfe7c
|
@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
|||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||
{
|
||||
/// <summary>Finds CIL instructions that reference a given event.</summary>
|
||||
public sealed class GenericEventFinder : BaseMethodFinder
|
||||
public sealed class EventFinder : BaseMethodFinder
|
||||
{
|
||||
/*********
|
||||
** Properties
|
||||
|
@ -30,7 +30,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
|||
/// <summary>Construct an instance.</summary>
|
||||
/// <param name="fullTypeName">The full type name for which to find references.</param>
|
||||
/// <param name="eventName">The event name for which to find references.</param>
|
||||
public GenericEventFinder(string fullTypeName, string eventName)
|
||||
public EventFinder(string fullTypeName, string eventName)
|
||||
{
|
||||
this.FullTypeName = fullTypeName;
|
||||
this.EventName = eventName;
|
|
@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
|||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||
{
|
||||
/// <summary>Finds CIL instructions that reference a given field.</summary>
|
||||
public sealed class GenericFieldFinder : BaseFieldFinder
|
||||
public sealed class FieldFinder : BaseFieldFinder
|
||||
{
|
||||
/*********
|
||||
** Properties
|
||||
|
@ -34,7 +34,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
|||
/// <param name="fullTypeName">The full type name for which to find references.</param>
|
||||
/// <param name="fieldName">The field name for which to find references.</param>
|
||||
/// <param name="isStatic">Whether the field to match is static.</param>
|
||||
public GenericFieldFinder(string fullTypeName, string fieldName, bool isStatic)
|
||||
public FieldFinder(string fullTypeName, string fieldName, bool isStatic)
|
||||
{
|
||||
this.FullTypeName = fullTypeName;
|
||||
this.FieldName = fieldName;
|
|
@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
|||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||
{
|
||||
/// <summary>Finds CIL instructions that reference a given method.</summary>
|
||||
public sealed class GenericMethodFinder : BaseMethodFinder
|
||||
public sealed class MethodFinder : BaseMethodFinder
|
||||
{
|
||||
/*********
|
||||
** Properties
|
||||
|
@ -30,7 +30,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
|||
/// <summary>Construct an instance.</summary>
|
||||
/// <param name="fullTypeName">The full type name for which to find references.</param>
|
||||
/// <param name="methodName">The method name for which to find references.</param>
|
||||
public GenericMethodFinder(string fullTypeName, string methodName)
|
||||
public MethodFinder(string fullTypeName, string methodName)
|
||||
{
|
||||
this.FullTypeName = fullTypeName;
|
||||
this.MethodName = methodName;
|
|
@ -5,7 +5,7 @@ using Mono.Cecil.Cil;
|
|||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||
{
|
||||
/// <summary>Finds CIL instructions that reference a given type.</summary>
|
||||
public sealed class GenericTypeFinder : IInstructionFinder
|
||||
public sealed class TypeFinder : IInstructionFinder
|
||||
{
|
||||
/*********
|
||||
** Accessors
|
||||
|
@ -26,7 +26,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
|||
*********/
|
||||
/// <summary>Construct an instance.</summary>
|
||||
/// <param name="fullTypeName">The full type name to match.</param>
|
||||
public GenericTypeFinder(string fullTypeName)
|
||||
public TypeFinder(string fullTypeName)
|
||||
{
|
||||
this.FullTypeName = fullTypeName;
|
||||
this.NounPhrase = $"obsolete {fullTypeName} type";
|
|
@ -6,7 +6,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
|||
namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
||||
{
|
||||
/// <summary>Rewrites field references into property references.</summary>
|
||||
public class GenericFieldToPropertyRewriter : BaseFieldRewriter
|
||||
public class FieldToPropertyRewriter : BaseFieldRewriter
|
||||
{
|
||||
/*********
|
||||
** Properties
|
||||
|
@ -32,7 +32,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
|||
/// <param name="type">The type whose field to which references should be rewritten.</param>
|
||||
/// <param name="fieldName">The field name to rewrite.</param>
|
||||
/// <param name="nounPhrase">A brief noun phrase indicating what the instruction finder matches (or <c>null</c> to generate one).</param>
|
||||
public GenericFieldToPropertyRewriter(Type type, string fieldName, string nounPhrase = null)
|
||||
public FieldToPropertyRewriter(Type type, string fieldName, string nounPhrase = null)
|
||||
{
|
||||
this.Type = type;
|
||||
this.FieldName = fieldName;
|
|
@ -6,7 +6,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
|||
namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
||||
{
|
||||
/// <summary>Rewrites method references from one parent type to another if the signatures match.</summary>
|
||||
public class GenericMethodMapper : BaseMethodRewriter
|
||||
public class MethodParentRewriter : BaseMethodRewriter
|
||||
{
|
||||
/*********
|
||||
** Properties
|
||||
|
@ -36,7 +36,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
|||
/// <param name="toType">The type with methods to map to.</param>
|
||||
/// <param name="onlyIfPlatformChanged">Whether to only rewrite references if loading the assembly on a different platform than it was compiled on.</param>
|
||||
/// <param name="nounPhrase">A brief noun phrase indicating what the instruction finder matches (or <c>null</c> to generate one).</param>
|
||||
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;
|
|
@ -66,22 +66,22 @@
|
|||
<Compile Include="..\GlobalAssemblyInfo.cs">
|
||||
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Finders\GenericFieldFinder.cs" />
|
||||
<Compile Include="Finders\GenericEventFinder.cs" />
|
||||
<Compile Include="Finders\GenericMethodFinder.cs" />
|
||||
<Compile Include="Finders\EventFinder.cs" />
|
||||
<Compile Include="Finders\FieldFinder.cs" />
|
||||
<Compile Include="Finders\MethodFinder.cs" />
|
||||
<Compile Include="Finders\TypeFinder.cs" />
|
||||
<Compile Include="Framework\BaseFieldFinder.cs" />
|
||||
<Compile Include="Framework\BaseFieldRewriter.cs" />
|
||||
<Compile Include="Framework\BaseMethodFinder.cs" />
|
||||
<Compile Include="Finders\GenericTypeFinder.cs" />
|
||||
<Compile Include="IInstructionRewriter.cs" />
|
||||
<Compile Include="Framework\BaseMethodRewriter.cs" />
|
||||
<Compile Include="Framework\RewriteHelper.cs" />
|
||||
<Compile Include="IInstructionFinder.cs" />
|
||||
<Compile Include="IInstructionRewriter.cs" />
|
||||
<Compile Include="Platform.cs" />
|
||||
<Compile Include="PlatformAssemblyMap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Framework\BaseFieldRewriter.cs" />
|
||||
<Compile Include="Framework\BaseMethodRewriter.cs" />
|
||||
<Compile Include="Framework\RewriteHelper.cs" />
|
||||
<Compile Include="Rewriters\GenericFieldToPropertyRewriter.cs" />
|
||||
<Compile Include="Rewriters\GenericMethodMapper.cs" />
|
||||
<Compile Include="Rewriters\FieldToPropertyRewriter.cs" />
|
||||
<Compile Include="Rewriters\MethodParentRewriter.cs" />
|
||||
<Compile Include="Rewriters\Wrappers\SpriteBatchWrapper.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -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))
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue