Files
7d2dXG/Mods/0A-KFCommonUtilityLib/Scripts/Attributes/MethodTargetAttribute.cs
Nathaniel Cosford e06f2bd282 Add All Mods
2025-05-29 23:33:28 +09:30

46 lines
1.2 KiB
C#

using System;
using HarmonyLib;
namespace KFCommonUtilityLib.Scripts.Attributes
{
public interface IMethodTarget
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class MethodTargetPrefixAttribute : Attribute, IMethodTarget
{
public MethodTargetPrefixAttribute()
{
}
}
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class MethodTargetPostfixAttribute : Attribute, IMethodTarget
{
public MethodTargetPostfixAttribute()
{
}
}
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class MethodTargetTranspilerAttribute : Attribute, IMethodTarget
{
public MethodTargetTranspilerAttribute()
{
}
}
public static class IMethodTargetExtension
{
public static string GetTargetMethodIdentifier(this HarmonyMethod self)
{
return (self.methodName ?? "this[]") + (self.argumentTypes == null ? string.Empty : string.Join(",", Array.ConvertAll(self.argumentTypes, type => type.FullDescription())));
}
}
}