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
|
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
{
|
{
|
||||||
/// <summary>Finds CIL instructions that reference a given event.</summary>
|
/// <summary>Finds CIL instructions that reference a given event.</summary>
|
||||||
public sealed class GenericEventFinder : BaseMethodFinder
|
public sealed class EventFinder : BaseMethodFinder
|
||||||
{
|
{
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** Properties
|
||||||
|
@ -30,7 +30,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
/// <summary>Construct an instance.</summary>
|
/// <summary>Construct an instance.</summary>
|
||||||
/// <param name="fullTypeName">The full type name for which to find references.</param>
|
/// <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>
|
/// <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.FullTypeName = fullTypeName;
|
||||||
this.EventName = eventName;
|
this.EventName = eventName;
|
|
@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
||||||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
{
|
{
|
||||||
/// <summary>Finds CIL instructions that reference a given field.</summary>
|
/// <summary>Finds CIL instructions that reference a given field.</summary>
|
||||||
public sealed class GenericFieldFinder : BaseFieldFinder
|
public sealed class FieldFinder : BaseFieldFinder
|
||||||
{
|
{
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** Properties
|
||||||
|
@ -34,7 +34,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
/// <param name="fullTypeName">The full type name for which to find references.</param>
|
/// <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="fieldName">The field name for which to find references.</param>
|
||||||
/// <param name="isStatic">Whether the field to match is static.</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.FullTypeName = fullTypeName;
|
||||||
this.FieldName = fieldName;
|
this.FieldName = fieldName;
|
|
@ -5,7 +5,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
||||||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
{
|
{
|
||||||
/// <summary>Finds CIL instructions that reference a given method.</summary>
|
/// <summary>Finds CIL instructions that reference a given method.</summary>
|
||||||
public sealed class GenericMethodFinder : BaseMethodFinder
|
public sealed class MethodFinder : BaseMethodFinder
|
||||||
{
|
{
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** Properties
|
||||||
|
@ -30,7 +30,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
/// <summary>Construct an instance.</summary>
|
/// <summary>Construct an instance.</summary>
|
||||||
/// <param name="fullTypeName">The full type name for which to find references.</param>
|
/// <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>
|
/// <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.FullTypeName = fullTypeName;
|
||||||
this.MethodName = methodName;
|
this.MethodName = methodName;
|
|
@ -5,7 +5,7 @@ using Mono.Cecil.Cil;
|
||||||
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
{
|
{
|
||||||
/// <summary>Finds CIL instructions that reference a given type.</summary>
|
/// <summary>Finds CIL instructions that reference a given type.</summary>
|
||||||
public sealed class GenericTypeFinder : IInstructionFinder
|
public sealed class TypeFinder : IInstructionFinder
|
||||||
{
|
{
|
||||||
/*********
|
/*********
|
||||||
** Accessors
|
** Accessors
|
||||||
|
@ -26,7 +26,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Finders
|
||||||
*********/
|
*********/
|
||||||
/// <summary>Construct an instance.</summary>
|
/// <summary>Construct an instance.</summary>
|
||||||
/// <param name="fullTypeName">The full type name to match.</param>
|
/// <param name="fullTypeName">The full type name to match.</param>
|
||||||
public GenericTypeFinder(string fullTypeName)
|
public TypeFinder(string fullTypeName)
|
||||||
{
|
{
|
||||||
this.FullTypeName = fullTypeName;
|
this.FullTypeName = fullTypeName;
|
||||||
this.NounPhrase = $"obsolete {fullTypeName} type";
|
this.NounPhrase = $"obsolete {fullTypeName} type";
|
|
@ -6,7 +6,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
||||||
namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
||||||
{
|
{
|
||||||
/// <summary>Rewrites field references into property references.</summary>
|
/// <summary>Rewrites field references into property references.</summary>
|
||||||
public class GenericFieldToPropertyRewriter : BaseFieldRewriter
|
public class FieldToPropertyRewriter : BaseFieldRewriter
|
||||||
{
|
{
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** 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="type">The type whose field to which references should be rewritten.</param>
|
||||||
/// <param name="fieldName">The field name to rewrite.</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>
|
/// <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.Type = type;
|
||||||
this.FieldName = fieldName;
|
this.FieldName = fieldName;
|
|
@ -6,7 +6,7 @@ using StardewModdingAPI.AssemblyRewriters.Framework;
|
||||||
namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
||||||
{
|
{
|
||||||
/// <summary>Rewrites method references from one parent type to another if the signatures match.</summary>
|
/// <summary>Rewrites method references from one parent type to another if the signatures match.</summary>
|
||||||
public class GenericMethodMapper : BaseMethodRewriter
|
public class MethodParentRewriter : BaseMethodRewriter
|
||||||
{
|
{
|
||||||
/*********
|
/*********
|
||||||
** Properties
|
** Properties
|
||||||
|
@ -36,7 +36,7 @@ namespace StardewModdingAPI.AssemblyRewriters.Rewriters
|
||||||
/// <param name="toType">The type with methods to map to.</param>
|
/// <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="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>
|
/// <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.FromType = fromType;
|
||||||
this.ToType = toType;
|
this.ToType = toType;
|
|
@ -66,22 +66,22 @@
|
||||||
<Compile Include="..\GlobalAssemblyInfo.cs">
|
<Compile Include="..\GlobalAssemblyInfo.cs">
|
||||||
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Finders\GenericFieldFinder.cs" />
|
<Compile Include="Finders\EventFinder.cs" />
|
||||||
<Compile Include="Finders\GenericEventFinder.cs" />
|
<Compile Include="Finders\FieldFinder.cs" />
|
||||||
<Compile Include="Finders\GenericMethodFinder.cs" />
|
<Compile Include="Finders\MethodFinder.cs" />
|
||||||
|
<Compile Include="Finders\TypeFinder.cs" />
|
||||||
<Compile Include="Framework\BaseFieldFinder.cs" />
|
<Compile Include="Framework\BaseFieldFinder.cs" />
|
||||||
|
<Compile Include="Framework\BaseFieldRewriter.cs" />
|
||||||
<Compile Include="Framework\BaseMethodFinder.cs" />
|
<Compile Include="Framework\BaseMethodFinder.cs" />
|
||||||
<Compile Include="Finders\GenericTypeFinder.cs" />
|
<Compile Include="Framework\BaseMethodRewriter.cs" />
|
||||||
<Compile Include="IInstructionRewriter.cs" />
|
<Compile Include="Framework\RewriteHelper.cs" />
|
||||||
<Compile Include="IInstructionFinder.cs" />
|
<Compile Include="IInstructionFinder.cs" />
|
||||||
|
<Compile Include="IInstructionRewriter.cs" />
|
||||||
<Compile Include="Platform.cs" />
|
<Compile Include="Platform.cs" />
|
||||||
<Compile Include="PlatformAssemblyMap.cs" />
|
<Compile Include="PlatformAssemblyMap.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Framework\BaseFieldRewriter.cs" />
|
<Compile Include="Rewriters\FieldToPropertyRewriter.cs" />
|
||||||
<Compile Include="Framework\BaseMethodRewriter.cs" />
|
<Compile Include="Rewriters\MethodParentRewriter.cs" />
|
||||||
<Compile Include="Framework\RewriteHelper.cs" />
|
|
||||||
<Compile Include="Rewriters\GenericFieldToPropertyRewriter.cs" />
|
|
||||||
<Compile Include="Rewriters\GenericMethodMapper.cs" />
|
|
||||||
<Compile Include="Rewriters\Wrappers\SpriteBatchWrapper.cs" />
|
<Compile Include="Rewriters\Wrappers\SpriteBatchWrapper.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -143,27 +143,27 @@ namespace StardewModdingAPI
|
||||||
return new IInstructionFinder[]
|
return new IInstructionFinder[]
|
||||||
{
|
{
|
||||||
// changes in Stardew Valley 1.2 (that don't have rewriters)
|
// changes in Stardew Valley 1.2 (that don't have rewriters)
|
||||||
new GenericFieldFinder("StardewValley.Game1", "borderFont", isStatic: true),
|
new FieldFinder("StardewValley.Game1", "borderFont", isStatic: true),
|
||||||
new GenericFieldFinder("StardewValley.Game1", "smoothFont", isStatic: true),
|
new FieldFinder("StardewValley.Game1", "smoothFont", isStatic: true),
|
||||||
new GenericFieldFinder("StardewValley.Item", "set_Name", isStatic: false),
|
new FieldFinder("StardewValley.Item", "set_Name", isStatic: false),
|
||||||
|
|
||||||
// APIs removed in SMAPI 1.9
|
// APIs removed in SMAPI 1.9
|
||||||
new GenericTypeFinder("StardewModdingAPI.Advanced.ConfigFile"),
|
new TypeFinder("StardewModdingAPI.Advanced.ConfigFile"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Advanced.IConfigFile"),
|
new TypeFinder("StardewModdingAPI.Advanced.IConfigFile"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Entities.SPlayer"),
|
new TypeFinder("StardewModdingAPI.Entities.SPlayer"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Extensions"),
|
new TypeFinder("StardewModdingAPI.Extensions"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Inheritance.ItemStackChange"),
|
new TypeFinder("StardewModdingAPI.Inheritance.ItemStackChange"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Inheritance.SGame"),
|
new TypeFinder("StardewModdingAPI.Inheritance.SGame"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Inheritance.SObject"),
|
new TypeFinder("StardewModdingAPI.Inheritance.SObject"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.LogWriter"),
|
new TypeFinder("StardewModdingAPI.LogWriter"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Manifest"),
|
new TypeFinder("StardewModdingAPI.Manifest"),
|
||||||
new GenericTypeFinder("StardewModdingAPI.Version"),
|
new TypeFinder("StardewModdingAPI.Version"),
|
||||||
new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawDebug"),
|
new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawDebug"),
|
||||||
new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawTick"),
|
new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawTick"),
|
||||||
new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderHudEventNoCheck"),
|
new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderHudEventNoCheck"),
|
||||||
new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderGuiEventNoCheck"),
|
new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderGuiEventNoCheck"),
|
||||||
new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderHudEventNoCheck"),
|
new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderHudEventNoCheck"),
|
||||||
new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck")
|
new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,12 +173,12 @@ namespace StardewModdingAPI
|
||||||
return new IInstructionRewriter[]
|
return new IInstructionRewriter[]
|
||||||
{
|
{
|
||||||
// crossplatform
|
// crossplatform
|
||||||
new GenericMethodMapper(typeof(SpriteBatch), typeof(SpriteBatchWrapper), onlyIfPlatformChanged: true),
|
new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchWrapper), onlyIfPlatformChanged: true),
|
||||||
|
|
||||||
// Stardew Valley 1.2
|
// Stardew Valley 1.2
|
||||||
new GenericFieldToPropertyRewriter(typeof(Game1), nameof(Game1.activeClickableMenu)),
|
new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.activeClickableMenu)),
|
||||||
new GenericFieldToPropertyRewriter(typeof(Game1), nameof(Game1.gameMode)),
|
new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.gameMode)),
|
||||||
new GenericFieldToPropertyRewriter(typeof(Game1), nameof(Game1.player))
|
new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.player))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue