public virtual IEnumerable <uSyncChange> GetChanges(XElement node, SyncSerializerOptions options) { if (serializer.IsEmpty(node)) { return(GetEmptyFileChanges(node).AsEnumerableOfOne()); } if (!serializer.IsValid(node)) { // not valid return(uSyncChange.Error("", "Invalid File", node.Name.LocalName).AsEnumerableOfOne()); } if (serializer.IsCurrent(node) == ChangeType.NoChange) { return(uSyncChange.NoChange("", node.GetAlias()).AsEnumerableOfOne()); } var changes = TrackChanges(); var item = serializer.FindItem(node); if (item != null) { var current = SerializeItem(item, options); if (current.Success) { return(CalculateChanges(changes, current.Item, node, "", "")); } } return(Enumerable.Empty <uSyncChange>()); }
public virtual IEnumerable <uSyncChange> GetChanges(XElement node) { if (serializer.IsEmpty(node)) { return(GetEmptyFileChanges(node).AsEnumerableOfOne()); } if (!serializer.IsValid(node)) { // not valid return(new uSyncChange() { Change = ChangeDetailType.Error, Name = "Invalid File", OldValue = node.Name.LocalName }.AsEnumerableOfOne());; } if (serializer.IsCurrent(node) == ChangeType.NoChange) { return(new uSyncChange() { Change = ChangeDetailType.NoChange, Name = node.GetAlias(), }.AsEnumerableOfOne()); } var changes = TrackChanges(); var item = serializer.FindItem(node); if (item != null) { var current = serializer.Serialize(item); if (current.Success) { return(CalculateChanges(changes, current.Item, node, "", "")); } } return(Enumerable.Empty <uSyncChange>()); }
public IEnumerable <uSyncChange> GetChanges(XElement target, SyncSerializerOptions options) { var item = serializer.FindItem(target); if (item != null) { var attempt = SerializeItem(item, options); if (attempt.Success) { return(GetChanges(target, attempt.Item, options)); } } return(GetChanges(target, XElement.Parse("<blank/>"), options)); }
public virtual IEnumerable <uSyncChange> GetChanges(XElement node, SyncSerializerOptions options) { XElement current = null; var item = serializer.FindItem(node); if (item != null) { var attempt = SerializeItem(item, options); if (attempt.Success) { current = attempt.Item; } } return(GetChanges(node, current, options)); }