use inheritdoc in rewriters
This commit is contained in:
parent
abfe40bf69
commit
ec4b81819a
|
@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.Result = result;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
if (!this.Flags.Contains(this.Result) && this.IsMatch(instruction))
|
||||
|
|
|
@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.Result = result;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
if (!this.Flags.Contains(this.Result) && RewriteHelper.IsFieldReferenceTo(instruction, this.FullTypeName, this.FieldName))
|
||||
|
|
|
@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.Result = result;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
if (!this.Flags.Contains(this.Result) && this.IsMatch(instruction))
|
||||
|
|
|
@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.Result = result;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
if (!this.Flags.Contains(this.Result) && this.IsMatch(instruction))
|
||||
|
|
|
@ -29,12 +29,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.ValidateReferencesToAssemblies = new HashSet<string>(validateReferencesToAssemblies);
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// field reference
|
||||
|
|
|
@ -29,12 +29,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.ValidateReferencesToAssemblies = new HashSet<string>(validateReferencesToAssemblies);
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// field reference
|
||||
|
|
|
@ -35,11 +35,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.ShouldIgnore = shouldIgnore;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a type reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="type">The type definition to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
|
||||
/// <returns>Returns whether the type was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
|
||||
{
|
||||
if (type.Scope.Name == this.AssemblyName && this.ShouldIgnore?.Invoke(type) != true)
|
||||
|
|
|
@ -35,11 +35,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
|
|||
this.ShouldIgnore = shouldIgnore;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a type reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="type">The type definition to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
|
||||
/// <returns>Returns whether the type was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
|
||||
{
|
||||
if (type.FullName == this.FullTypeName && this.ShouldIgnore?.Invoke(type) != true)
|
||||
|
|
|
@ -11,35 +11,26 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework
|
|||
/*********
|
||||
** Accessors
|
||||
*********/
|
||||
/// <summary>A brief noun phrase indicating what the handler matches, used if <see cref="Phrases"/> is empty.</summary>
|
||||
/// <inheritdoc />
|
||||
public string DefaultPhrase { get; }
|
||||
|
||||
/// <summary>The rewrite flags raised for the current module.</summary>
|
||||
/// <inheritdoc />
|
||||
public ISet<InstructionHandleResult> Flags { get; } = new HashSet<InstructionHandleResult>();
|
||||
|
||||
/// <summary>The brief noun phrases indicating what the handler matched for the current module.</summary>
|
||||
/// <inheritdoc />
|
||||
public ISet<string> Phrases { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
||||
/*********
|
||||
** Public methods
|
||||
*********/
|
||||
/// <summary>Rewrite a type reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="type">The type definition to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
|
||||
/// <returns>Returns whether the type was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public virtual bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public virtual bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -49,12 +49,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// get field reference
|
||||
|
|
|
@ -28,12 +28,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies);
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// get field ref
|
||||
|
|
|
@ -25,11 +25,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
public Harmony1AssemblyRewriter()
|
||||
: base(defaultPhrase: "Harmony 1.x") { }
|
||||
|
||||
/// <summary>Rewrite a type reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="type">The type definition to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
|
||||
/// <returns>Returns whether the type was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
|
||||
{
|
||||
// rewrite Harmony 1.x type to Harmony 2.0 type
|
||||
|
@ -45,12 +41,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// rewrite Harmony 1.x methods to Harmony 2.0
|
||||
|
|
|
@ -40,12 +40,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
public MethodParentRewriter(Type fromType, Type toType, string nounPhrase = null)
|
||||
: this(fromType.FullName, toType, nounPhrase) { }
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// get method ref
|
||||
|
|
|
@ -28,12 +28,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies);
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// get method ref
|
||||
|
|
|
@ -37,12 +37,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
this.Value = value;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="cil">The CIL processor.</param>
|
||||
/// <param name="instruction">The CIL instruction to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
|
||||
/// <returns>Returns whether the instruction was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
|
||||
{
|
||||
// get field reference
|
||||
|
|
|
@ -35,11 +35,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
|
|||
this.ShouldIgnore = shouldIgnore;
|
||||
}
|
||||
|
||||
/// <summary>Rewrite a type reference if needed.</summary>
|
||||
/// <param name="module">The assembly module containing the instruction.</param>
|
||||
/// <param name="type">The type definition to handle.</param>
|
||||
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
|
||||
/// <returns>Returns whether the type was changed.</returns>
|
||||
/// <inheritdoc />
|
||||
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
|
||||
{
|
||||
// check type reference
|
||||
|
|
Loading…
Reference in New Issue