init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user