Files
Workspace/Assets/Modules/ShrinkModFramework/Runtime/Metadata/ShrinkModAttribute.cs
T

30 lines
1.1 KiB
C#

using System;
namespace ShrinkModFramework
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class ShrinkModAttribute : Attribute
{
public string ModId { get; }
public string DisplayName { get; }
public string Version { get; }
public int LoadOrder { get; }
public bool AutoApplyHarmonyPatches { get; set; } = true;
public ShrinkModAttribute(string modId, string displayName, string version, int loadOrder = 0)
{
if (string.IsNullOrWhiteSpace(modId))
throw new ArgumentException("模组 ID 不能为空。", nameof(modId));
if (string.IsNullOrWhiteSpace(displayName))
throw new ArgumentException("模组显示名不能为空。", nameof(displayName));
if (string.IsNullOrWhiteSpace(version))
throw new ArgumentException("模组版本不能为空。", nameof(version));
ModId = modId.Trim();
DisplayName = displayName.Trim();
Version = version.Trim();
LoadOrder = loadOrder;
}
}
}