- ShrinkModComponentDiscovery.Discover 公开:只发现、不执行生命周期 - ShrinkModLoader.LoadComposed / ShrinkModCordisRuntime.ApplyComposedAsync:宿主提供元数据组合加载,支持纯数据包与 IShrinkModWrapper 公开真实实例 - 公开 TryAttachEventBusInstance,随生命周期逆操作释放 - 依赖新增 VersionRange(Maven/Forge 区间语法)与 Ordering(Before/After) - AssemblyResolvePolicy 可限制跨模组程序集解析
27 lines
1001 B
C#
27 lines
1001 B
C#
using System;
|
|
|
|
namespace ShrinkModFramework
|
|
{
|
|
public enum ShrinkModDependencyOrdering { None, Before, After }
|
|
|
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
|
public sealed class ShrinkModDependencyAttribute : Attribute
|
|
{
|
|
public string ModId { get; }
|
|
public string MinimumVersion { get; }
|
|
public bool Optional { get; }
|
|
public string VersionRange { get; set; }
|
|
public ShrinkModDependencyOrdering Ordering { get; set; } = ShrinkModDependencyOrdering.After;
|
|
|
|
public ShrinkModDependencyAttribute(string modId, string minimumVersion = null, bool optional = false)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(modId))
|
|
throw new ArgumentException("依赖模组 ID 不能为空。", nameof(modId));
|
|
|
|
ModId = modId.Trim();
|
|
MinimumVersion = string.IsNullOrWhiteSpace(minimumVersion) ? null : minimumVersion.Trim();
|
|
Optional = optional;
|
|
}
|
|
}
|
|
}
|