using System; // ReSharper disable once CheckNamespace namespace DTS.DASLib.Service { /// /// this attribute controls whether a gain is disabled or not /// this was done for /// http://fogbugz/fogbugz/default.asp?10080 /// to prevent the higher range gains which were considered just not useful /// this attribute is optional, it is assume the gain is not disabled /// unless it's explicitly marked as disabled /// public class GainDisabledAttribute : Attribute { /// /// returns whether the gain is disabled or not /// http://fogbugz/fogbugz/default.asp?10080 /// /// /// public static bool IsGainDisabled(object o) { if (o == null) return false; var mi = o.GetType().GetMember(o.ToString()); if (mi.Length <= 0) return false; return GetCustomAttribute(mi[0], typeof(GainDisabledAttribute)) is GainDisabledAttribute attr && attr._bDisabled; } private readonly bool _bDisabled; public GainDisabledAttribute(bool disabled) { _bDisabled = disabled; } } }