private void elements_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (elements.SelectedItem == null || (elements.SelectedItem as AssemblyElementPicker.TreeNodeViewModel) == null || !((elements.SelectedItem as AssemblyElementPicker.TreeNodeViewModel).Object is IAnnotationProvider)) { confusionList.ItemsSource = null; elementSet.IsEnabled = false; return; } else { elementSet.IsEnabled = true; } IAnnotationProvider provider = (elements.SelectedItem as AssemblyElementPicker.TreeNodeViewModel).Object as IAnnotationProvider; IDictionary <Core.IConfusion, NameValueCollection> dict; if (!provider.Annotations.Contains("ConfusionSets")) { provider.Annotations["ConfusionSets"] = dict = new ConfusionSets(); } else { dict = provider.Annotations["ConfusionSets"] as IDictionary <Core.IConfusion, NameValueCollection>; } confusionList.ItemsSource = dict; }
void SetChilds(IAnnotationProvider obj, IDictionary <Core.IConfusion, NameValueCollection> dict) { ConfusionSets s = new ConfusionSets(); foreach (KeyValuePair <Core.IConfusion, NameValueCollection> pair in dict) { s.Add(pair.Key, pair.Value); } obj.Annotations["ConfusionSets"] = s; System.Collections.IEnumerable e; if (obj is AssemblyDefinition) { e = (obj as AssemblyDefinition).Modules; } else if (obj is ModuleDefinition) { e = (obj as ModuleDefinition).Types; } else if (obj is TypeDefinition) { TypeDefinition type = obj as TypeDefinition; System.Collections.ArrayList anno = new System.Collections.ArrayList(); anno.AddRange(type.NestedTypes); anno.AddRange(type.Methods); anno.AddRange(type.Fields); anno.AddRange(type.Properties); anno.AddRange(type.Events); e = anno; } else { e = Enumerable.Empty <object>(); } foreach (IAnnotationProvider provider in e) { SetChilds(provider, dict); } }
public CSEnumerator(ConfusionSets sets) { this.sets = sets; this.idx = -1; }