/// <summary> /// Constructor. /// </summary> /// <param name="delta"></param> /// <param name="obj"></param> /// <param name="attr"></param> public AttributeNode(Delta delta, ImportObject obj, ImportChange attr) { this.delta = delta; this.obj = obj; this.attr = attr; this.attr.PropertyChanged += SourcePropertyChanged; }
public static void LoadExclusions(Delta delta, string file) { var serializer = new XmlSerializer(typeof(List <ExclusionObject>)); List <ExclusionObject> objectList; try { using (var r = XmlReader.Create(file)) objectList = (List <ExclusionObject>)serializer.Deserialize(r); } catch (InvalidOperationException ex) { System.Windows.MessageBox.Show(string.Format("Unable to deserialize XML. Verify that you loaded an exclusion file.")); return; } int foundObjectCount = 0; int notFoundObjectCount = 0; int foundAttributeCount = 0; int notFoundAttributeCount = 0; foreach (ExclusionObject exclusion_object in objectList) { try { ImportObject o = delta.Objects.First(x => x.SourceObjectIdentifier == exclusion_object.SourceObjectIdentifier && x.TargetObjectIdentifier == exclusion_object.TargetObjectIdentifier); foundObjectCount++; try { foreach (var change in exclusion_object.Changes) { ImportChange c = o.Changes.First(x => x.Operation == change.Operation && x.AttributeName == change.AttributeName && x.AttributeValue == change.AttributeValue); c.IsIncluded = false; foundAttributeCount++; } } catch (InvalidOperationException) { notFoundAttributeCount++; } // If there were no sub changes, exclude the parent if (exclusion_object.Changes.Length == 0) { o.IsIncluded = false; } } catch (InvalidOperationException) { notFoundObjectCount++; } } System.Windows.MessageBox.Show(string.Format("Found and excluded {0} object and {1} attributes. {2} objects and {3} attributes were not found", foundObjectCount, foundAttributeCount, notFoundObjectCount, notFoundAttributeCount)); }