using System; // ReSharper disable once CheckNamespace namespace DTS.DASLib.Service { /// /// /// this attribute controls the minimum input range for a gain /// note that we could calculate this, but this allows us some flexibility /// in real life there are calibration and other factors that can affect what actually /// is achievable at a given gain step, so this minimum input could be a theoretical one /// http://fogbugz/fogbugz/default.asp?10080 /// public class MinInputRangeAttribute : Attribute { /// /// returns the minimum input range for a gain /// http://fogbugz/fogbugz/default.asp?10080 /// /// /// public static double GetMinInputRangemV(object o) { if (o == null) return 0D; var mi = o.GetType().GetMember(o.ToString()); if (mi.Length <= 0) return 0D; return GetCustomAttribute(mi[0], typeof(MinInputRangeAttribute)) is MinInputRangeAttribute attr ? attr._minimumInputRangemV : 0D; } private readonly double _minimumInputRangemV; public MinInputRangeAttribute(double minInputRangemV) { _minimumInputRangemV = minInputRangemV; } } }