2024-11-15 11:37:55 +08:00
|
|
|
|
namespace CirculateTool.Attribute;
|
2024-10-07 09:51:55 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 在指定时间执行的任务
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="times"></param>
|
|
|
|
|
|
/// <param name="methodDescription"></param>
|
|
|
|
|
|
/// <param name="tags"></param>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 只能加载公共 void 方法上,
|
|
|
|
|
|
/// 不得与<see cref="CirculationAttribute"/>同时使用,若同时使用则此项不生效
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
[AttributeUsage(AttributeTargets.Method)]
|
|
|
|
|
|
public class CirculationTimeAttribute(string[] times, string? methodDescription = null, string[]? tags = null) : System.Attribute
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 定时执行的时间
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <example>12:00</example>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 格式必须为:HH:mm,例如:12:00,其他格式将无效
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
public string[] Times { get; } = times;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 描述
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string? MethodDescription { get; } = methodDescription;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 标签
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string[]? Tags { get; } = tags;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return string.Join(",", Times);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|