From dc6087211e5164a0506fe79dec44a6ac47d33f80 Mon Sep 17 00:00:00 2001 From: xiaoxin <2932869213@qq.com> Date: Mon, 13 Oct 2025 18:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20Attributes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Attributes/EnableGameVersionAttribute.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Attributes/EnableGameVersionAttribute.cs diff --git a/Attributes/EnableGameVersionAttribute.cs b/Attributes/EnableGameVersionAttribute.cs new file mode 100644 index 0000000..2005259 --- /dev/null +++ b/Attributes/EnableGameVersionAttribute.cs @@ -0,0 +1,19 @@ +using System; + +namespace SinmaiAssist.Attributes; + +[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] +public class EnableGameVersionAttribute(uint minGameVersion, uint maxGameVersion = 99999): Attribute +{ + public uint MinGameVersion { get; } = minGameVersion; + public uint MaxGameVersion { get; } = maxGameVersion; + + public bool ShouldEnable() + { + if (SinmaiAssist.GameVersion >= MinGameVersion && SinmaiAssist.GameVersion <= MaxGameVersion) + { + return true; + } + return false; + } +} \ No newline at end of file