static List <FxCopCategory> GetRuleListAndSort(string fxCopPath, string[] ruleAssemblies)
        {
            AppDomainSetup setup = new AppDomainSetup();

            setup.DisallowCodeDownload = true;
            setup.ApplicationBase      = fxCopPath;
            AppDomain domain = AppDomain.CreateDomain("FxCop Rule Loading Domain", AppDomain.CurrentDomain.Evidence, setup);

            FxCopRule[] ruleList;
            try {
                FxCopWrapper wrapper = (FxCopWrapper)domain.CreateInstanceFromAndUnwrap(typeof(FxCopWrapper).Assembly.Location, typeof(FxCopWrapper).FullName);

                ruleList = wrapper.GetRuleListInstanceMethod(fxCopPath, ruleAssemblies);
            } finally {
                AppDomain.Unload(domain);
            }

            Array.Sort(ruleList);
            List <FxCopCategory> rules = new List <FxCopCategory>();

            lock (ruleDict) {
                FxCopCategory cat = null;
                foreach (FxCopRule rule in ruleList)
                {
                    if (cat == null || cat.Name != rule.CategoryName)
                    {
                        cat = new FxCopCategory(rule.CategoryName);
                        rules.Add(cat);
                    }
                    cat.Rules.Add(rule);
                }
                ruleDict[ruleAssemblies] = rules;
            }
            return(rules);
        }
Esempio n. 2
0
 public CategoryTreeNode(FxCopCategory category) : base()
 {
     this.category = category;
     foreach (FxCopRule rule in category.Rules)
     {
         this.Children.Add(new RuleTreeNode(rule));
     }
 }
		public CategoryTreeNode(FxCopCategory category):base()
		{
			
			this.category = category;
			foreach (FxCopRule rule in category.Rules) {
				this.Children.Add(new RuleTreeNode(rule));
			}
		}
			public CategoryTreeNode(FxCopCategory category)
			{
				this.category = category;
				this.Text = category.DisplayName;
				foreach (FxCopRule rule in category.Rules) {
					this.Nodes.Add(new RuleTreeNode(rule));
				}
			}
 public CategoryTreeNode(FxCopCategory category)
 {
     this.category = category;
     this.Text     = category.DisplayName;
     foreach (FxCopRule rule in category.Rules)
     {
         this.Nodes.Add(new RuleTreeNode(rule));
     }
 }