using System; // ReSharper disable once CheckNamespace namespace DTS.DASLib.Service { /// /// /// This attribute is used to control whether a gain is available to unmodified gen 3 SPS /// http://fogbugz/fogbugz/default.asp?10080 /// the gain should still be available for modified SPS /// this attribute is optional, it is assumed to be available unless explicitly marked as /// unavailable /// public class GainAvailableUnmodifiedAttribute : Attribute { /// /// returns whether gain is available to unmodified SPS gen 3 or not /// http://fogbugz/fogbugz/default.asp?10080 /// /// /// public static bool IsGainAvailableToUnmodified(object o) { if (o == null) return true; var mi = o.GetType().GetMember(o.ToString()); if (mi.Length <= 0) return true; return !(GetCustomAttribute(mi[0], typeof(GainAvailableUnmodifiedAttribute)) is GainAvailableUnmodifiedAttribute attr) || attr._bAvailable; } private readonly bool _bAvailable; public GainAvailableUnmodifiedAttribute(bool available) { _bAvailable = available; } } }