|
|
@ -6,7 +6,6 @@ |
|
|
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
|
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Drawing; |
|
|
|
using System.Drawing; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows; |
|
|
@ -27,8 +26,6 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
{ |
|
|
|
{ |
|
|
|
private int index; |
|
|
|
private int index; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseTree() |
|
|
|
public BaseTree() |
|
|
|
{ |
|
|
|
{ |
|
|
|
RuleState = new ObservableCollection<Tuple<ImageSource,string>>(); |
|
|
|
RuleState = new ObservableCollection<Tuple<ImageSource,string>>(); |
|
|
@ -45,6 +42,7 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static ImageSource ToImageSource( Icon icon) |
|
|
|
private static ImageSource ToImageSource( Icon icon) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Bitmap bitmap = icon.ToBitmap(); |
|
|
|
Bitmap bitmap = icon.ToBitmap(); |
|
|
@ -60,7 +58,6 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<Tuple<ImageSource,string>> RuleState {get;set;} |
|
|
|
public ObservableCollection<Tuple<ImageSource,string>> RuleState {get;set;} |
|
|
|
|
|
|
|
|
|
|
|
private Tuple<Icon,string> selectedItem; |
|
|
|
private Tuple<Icon,string> selectedItem; |
|
|
@ -93,7 +90,6 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
foreach (FxCopRule rule in category.Rules) { |
|
|
|
foreach (FxCopRule rule in category.Rules) { |
|
|
|
this.Children.Add(new RuleTreeNode(rule)); |
|
|
|
this.Children.Add(new RuleTreeNode(rule)); |
|
|
|
} |
|
|
|
} |
|
|
|
CheckMode(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -101,6 +97,7 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
get { return true; } |
|
|
|
get { return true; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object Text { |
|
|
|
public override object Text { |
|
|
|
get { return category.DisplayName; } |
|
|
|
get { return category.DisplayName; } |
|
|
|
} |
|
|
|
} |
|
|
@ -111,12 +108,7 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
set { |
|
|
|
set { |
|
|
|
if (value != base.Index) { |
|
|
|
if (value != base.Index) { |
|
|
|
base.Index = value; |
|
|
|
base.Index = value; |
|
|
|
if (mixedModeTuple == null) { |
|
|
|
RaisePropertyChanged("Index"); |
|
|
|
foreach (RuleTreeNode rule in this.Children) { |
|
|
|
|
|
|
|
rule.Index = Index; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
CheckMode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -131,10 +123,10 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
RuleState.Add(mixedModeTuple); |
|
|
|
RuleState.Add(mixedModeTuple); |
|
|
|
Index = RuleState.Count -1; |
|
|
|
Index = RuleState.Count -1; |
|
|
|
base.RaisePropertyChanged("Index"); |
|
|
|
base.RaisePropertyChanged("Index"); |
|
|
|
CheckMode(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void RemoveMixedMode() |
|
|
|
private void RemoveMixedMode() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (mixedModeTuple != null) { |
|
|
|
if (mixedModeTuple != null) { |
|
|
@ -142,61 +134,26 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
RuleState.Remove(mixedModeTuple); |
|
|
|
RuleState.Remove(mixedModeTuple); |
|
|
|
mixedModeTuple = null; |
|
|
|
mixedModeTuple = null; |
|
|
|
base.RaisePropertyChanged("Index"); |
|
|
|
base.RaisePropertyChanged("Index"); |
|
|
|
CheckMode(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void CheckMode () |
|
|
|
public void CheckMode () |
|
|
|
{ |
|
|
|
{ |
|
|
|
var state = ErrorState; |
|
|
|
var state = ErrorState; |
|
|
|
|
|
|
|
|
|
|
|
if (state == 0) { |
|
|
|
if (state == 0) { |
|
|
|
RemoveMixedMode(); |
|
|
|
RemoveMixedMode(); |
|
|
|
|
|
|
|
Index = 0; |
|
|
|
} else if (state == 1) { |
|
|
|
} else if (state == 1) { |
|
|
|
// RemoveMixedMode();
|
|
|
|
RemoveMixedMode(); |
|
|
|
AddMixedMode(); |
|
|
|
Index = 1; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
AddMixedMode(); |
|
|
|
AddMixedMode(); |
|
|
|
Console.WriteLine("Unchecked"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
public void CheckMode () |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// if (! ignoreCheckMode) {
|
|
|
|
|
|
|
|
// Console.WriteLine("CheckMode");
|
|
|
|
|
|
|
|
if (!ErrorState.HasValue) { |
|
|
|
|
|
|
|
// Console.WriteLine ("\t{0} is Mixed Mode",Text);
|
|
|
|
|
|
|
|
AddMixedMode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
RemoveMixedMode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
public Nullable<bool> ErrorState { |
|
|
|
|
|
|
|
get { |
|
|
|
|
|
|
|
bool allWarn = true; |
|
|
|
|
|
|
|
bool allErr = true; |
|
|
|
|
|
|
|
foreach (RuleTreeNode tn in Children) { |
|
|
|
|
|
|
|
if (tn.isError) |
|
|
|
|
|
|
|
allWarn = false; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
allErr = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (allErr) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
else if (allWarn) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal int ErrorState { |
|
|
|
internal int ErrorState { |
|
|
|
get { |
|
|
|
get { |
|
|
@ -208,21 +165,11 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
else |
|
|
|
else |
|
|
|
allErr = false; |
|
|
|
allErr = false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* |
|
|
|
|
|
|
|
if (allErr) |
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
else if (allWarn) |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
if (allErr) |
|
|
|
if (allErr) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
if (allWarn) { |
|
|
|
if (allWarn) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
// else
|
|
|
|
|
|
|
|
// return -1;
|
|
|
|
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -245,14 +192,17 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
this.rule = rule; |
|
|
|
this.rule = rule; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool IsCheckable { |
|
|
|
public override bool IsCheckable { |
|
|
|
get { return true; } |
|
|
|
get { return true; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object Text { |
|
|
|
public override object Text { |
|
|
|
get { return rule.CheckId + " : " + rule.DisplayName; } |
|
|
|
get { return rule.CheckId + " : " + rule.DisplayName; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Identifier { |
|
|
|
public string Identifier { |
|
|
|
get { |
|
|
|
get { |
|
|
|
return rule.CategoryName + "#" + rule.CheckId; |
|
|
|
return rule.CategoryName + "#" + rule.CheckId; |
|
|
@ -265,14 +215,8 @@ namespace ICSharpCode.CodeAnalysis |
|
|
|
set { |
|
|
|
set { |
|
|
|
if (base.Index != value) { |
|
|
|
if (base.Index != value) { |
|
|
|
isError = value == 1; |
|
|
|
isError = value == 1; |
|
|
|
if (isError) { |
|
|
|
|
|
|
|
Console.WriteLine ("RuleNode {0} - index {1} - error {2}",rule.DisplayName,Index, isError); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
base.Index = value; |
|
|
|
base.Index = value; |
|
|
|
RaisePropertyChanged("Index"); |
|
|
|
RaisePropertyChanged("Index"); |
|
|
|
var parent = Parent as CategoryTreeNode; |
|
|
|
|
|
|
|
parent.CheckMode(); |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|