Files
DP44/DataPRO/IService/.svn/pristine/04/048e9cdbcd02a1bfc7f47da9b961434201d5560a.svn-base

36 lines
1.3 KiB
Plaintext
Raw Normal View History

2026-04-17 14:55:32 -04:00
using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <inheritdoc />
/// <summary>
/// this attribute allows us to associate a max input range in mV for a gain
/// note that this can be computed using the gain itself and the input range
/// but this allows us to more tightly control things (say by using 2450 instead of 2500 for full range or something similar)
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
public class MaxInputRangeAttribute : Attribute
{
/// <summary>
/// returns the max input range in mV for gain
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static double GetMaxInputRangemV(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(MaxInputRangeAttribute)) is MaxInputRangeAttribute attr ? attr._maximumInputRangemV : 0D;
}
private readonly double _maximumInputRangemV;
public MaxInputRangeAttribute(double maxInputRangemV)
{
_maximumInputRangemV = maxInputRangemV;
}
}
}