mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
先想到这吧
This commit is contained in:
@@ -49,4 +49,99 @@ namespace Serein.Library.Attributes
|
||||
public string LockName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//[AttributeUsage(AttributeTargets.Field)]
|
||||
//public class BindTypeAttribute : Attribute
|
||||
//{
|
||||
// public Type Type { get; }
|
||||
|
||||
// public BindTypeAttribute(Type type)
|
||||
// {
|
||||
// Type = type;
|
||||
// }
|
||||
//}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class BindValueAttribute : Attribute
|
||||
{
|
||||
public object Value { get; }
|
||||
|
||||
public BindValueAttribute(object value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class PLCValueAttribute : Attribute
|
||||
{
|
||||
public enum VarType
|
||||
{
|
||||
/// <summary>
|
||||
/// 可写入值
|
||||
/// </summary>
|
||||
Write,
|
||||
/// <summary>
|
||||
/// 定时读取的可写入值(用来写入前判断),应该几乎不会有这种类型?
|
||||
/// </summary>
|
||||
TimingReadOrWrite,
|
||||
/// <summary>
|
||||
/// 只读取值(使用时刷新)
|
||||
/// </summary>
|
||||
ReadOnly,
|
||||
/// <summary>
|
||||
/// 定时刷新的只读取值(定时刷新用来触发触发器)
|
||||
/// </summary>
|
||||
TimingReadOnly,
|
||||
}
|
||||
|
||||
public bool IsProtected { get; }
|
||||
public Type DataType { get; }
|
||||
public string Var { get; }
|
||||
//public int Length { get; }
|
||||
//public double Offset { get; }
|
||||
public VarType Type { get; }
|
||||
//public int RefreshInterval { get; }
|
||||
|
||||
|
||||
|
||||
public PLCValueAttribute(Type type,
|
||||
string @var,
|
||||
VarType varType
|
||||
//int refreshInterval = 100
|
||||
)
|
||||
{
|
||||
DataType = type;
|
||||
Var = @var;
|
||||
//Offset = offset;
|
||||
//RefreshInterval = refreshInterval;
|
||||
Type = varType;
|
||||
//Length = length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 枚举值转换器
|
||||
/// </summary>
|
||||
|
||||
//[AttributeUsage(AttributeTargets.Parameter)]
|
||||
//public class EnumConvertorAttribute : Attribute
|
||||
//{
|
||||
// public Type Enum { get; }
|
||||
|
||||
// public EnumConvertorAttribute(Type @enum)
|
||||
// {
|
||||
// if (@enum.IsEnum)
|
||||
// {
|
||||
// Enum = @enum;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new ArgumentException("需要枚举类型");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user