public string GenerateDescription()
        {
            StringBuilder ops = new StringBuilder();

            foreach (PropertyInfo prop in GetType().GetProperties())
            {
                ItemPropertyAttribute propAttr = (ItemPropertyAttribute)Attribute.GetCustomAttribute(prop, typeof(ItemPropertyAttribute));
                var pval = prop.GetValue(this, null);
                if (object.Equals(pval, propAttr.DefaultValue))
                {
                    continue;
                }
                if (ops.Length > 0)
                {
                    ops.Append(", ");
                }
                var nameAttr = (LocalizedDisplayNameAttribute)Attribute.GetCustomAttribute(prop, typeof(LocalizedDisplayNameAttribute));
                ops.Append(nameAttr.DisplayName);
                if (!(pval is bool))
                {
                    ops.Append(": " + GetValue(pval));
                }
            }
            return(ops.ToString());
        }
Beispiel #2
0
 public MonoExecutionParameters()
 {
     foreach (PropertyInfo prop in GetType ().GetProperties ()) {
         ItemPropertyAttribute propAttr = (ItemPropertyAttribute) Attribute.GetCustomAttribute (prop, typeof(ItemPropertyAttribute));
         if (propAttr != null) {
             if (propAttr.DefaultValue != null)
                 prop.SetValue (this, propAttr.DefaultValue, null);
         }
     }
 }