Files
DP44/DataPRO/IService/.svn/pristine/77/77ecd04f82e2948e6d85a6476599db7ada882734.svn-base
2026-04-17 14:55:32 -04:00

37 lines
1.4 KiB
Plaintext

using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <inheritdoc />
/// <summary>
/// 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
/// </summary>
public class MinInputRangeAttribute : Attribute
{
/// <summary>
/// returns the minimum input range for a gain
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
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;
}
}
}