66 lines
1.5 KiB
C#
66 lines
1.5 KiB
C#
|
|
using System;
|
||
|
|
using System.ComponentModel;
|
||
|
|
|
||
|
|
namespace DTS.Common.Utilities
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Enumeration of all possible Data Flags
|
||
|
|
///
|
||
|
|
/// </summary>
|
||
|
|
public enum DataFlag
|
||
|
|
{
|
||
|
|
[Description("None")]
|
||
|
|
[Flag(0)]
|
||
|
|
None,
|
||
|
|
|
||
|
|
[Description("Normal")]
|
||
|
|
[Flag(1)]
|
||
|
|
Normal,
|
||
|
|
|
||
|
|
[Description("Saturated")]
|
||
|
|
[Flag(2)]
|
||
|
|
Saturated,
|
||
|
|
|
||
|
|
[Description("Zero Crossing Error")]
|
||
|
|
[Flag(3)]
|
||
|
|
ZeroCrossing,
|
||
|
|
|
||
|
|
[Description("Broken Wire")]
|
||
|
|
[Flag(4)]
|
||
|
|
BrokenWire,
|
||
|
|
|
||
|
|
[Description("Other")]
|
||
|
|
[Flag(-1)]
|
||
|
|
Other
|
||
|
|
}
|
||
|
|
|
||
|
|
[AttributeUsage(AttributeTargets.Field)]
|
||
|
|
public class FlagAttribute : Attribute
|
||
|
|
{
|
||
|
|
public int Flag { get; }
|
||
|
|
|
||
|
|
////////////////////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
|
||
|
|
public FlagAttribute(int flag)
|
||
|
|
{
|
||
|
|
Flag = flag;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <inheritdoc />
|
||
|
|
/// <summary>
|
||
|
|
/// Tool for manipulating <see cref="T:DTS.Common.Utilities.ChannelFilter" />-attached <see cref="T:DTS.Common.Utilities.IsoDescriptionAttribute" />s.
|
||
|
|
/// </summary>
|
||
|
|
public class DataFlagAttributeCoder
|
||
|
|
: AttributeCoder<DataFlag, FlagAttribute, int>
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Initializes an instance of the IsoDescriptionAttributeCoder class.
|
||
|
|
/// </summary>
|
||
|
|
public DataFlagAttributeCoder()
|
||
|
|
: base(attribute => attribute.Flag, null)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|