init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.DASLib.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
public class GainDisabledAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// returns whether the gain is disabled or not
|
||||
/// http://fogbugz/fogbugz/default.asp?10080
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user