Author: nestor
Date: 2008-02-12 11:14:47 -0500 (Tue, 12 Feb 2008)
New Revision: 95523

Modified:
   trunk/mono-tools/gendarme/framework/Gendarme.Framework/Rule.cs
Log:
Look for the Problem and Solution in the attributes or override the method.



Modified: trunk/mono-tools/gendarme/framework/Gendarme.Framework/Rule.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Gendarme.Framework/Rule.cs      
2008-02-12 15:50:54 UTC (rev 95522)
+++ trunk/mono-tools/gendarme/framework/Gendarme.Framework/Rule.cs      
2008-02-12 16:14:47 UTC (rev 95523)
@@ -67,9 +67,24 @@
                        }
                }
 
-               public abstract string Problem { get; }
+               public virtual string Problem { 
+                       get {
+                               //use cecil instead?
+                               object[] attributes = GetType 
().GetCustomAttributes (typeof (ProblemAttribute),false);
+                               if (attributes.Length != 0)
+                                       return 
((ProblemAttribute)attributes[0]).Problem;
+                               return String.Empty;
+                       }
+               }
 
-               public abstract string Solution { get; }
+               public virtual string Solution { 
+                       get {
+                               object[] attributes = GetType 
().GetCustomAttributes (typeof (SolutionAttribute),false);
+                               if (attributes.Length != 0)
+                                       return 
((SolutionAttribute)attributes[0]).Solution;
+                               return String.Empty;
+                       }
+               }
 
                /// <summary>
                /// Return an Uri instance to the rule documentation.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to