示例#1
0
 void RemoveNode(IMetadataObject left, IList<MetadataTreeEntryChanges> changed, Stack<string> stack)
 {
     var path = stack.ToDataPath();
     changed.Add(new MetadataTreeEntryChanges(path, ChangeKind.Deleted, old: left));
     var dataAccessor = _modelDataProvider.Get(left.GetType());
     foreach (var childProperty in dataAccessor.ChildProperties)
     {
         stack.Push(childProperty.Name);
         foreach (var child in left.Children)
         {
             stack.Push(child.Id.ToString());
             RemoveNode(child, changed, stack);
             stack.Pop();
         }
         stack.Pop();
     }
 }
示例#2
0
        void CompareNode(IMetadataObject original, IMetadataObject @new, IList<MetadataTreeEntryChanges> changes, Stack<string> stack)
        {
            var accessor = _modelDataProvider.Get(original.GetType());
            UpdateNodeIfNeeded(original, @new, stack, accessor, changes);
            foreach (var childProperty in accessor.ChildProperties)
            {
                if (!childProperty.ShouldVisitChildren(original) && !childProperty.ShouldVisitChildren(@new))
                {
                    // Do not visit children if they were not generated.
                    // This means that they were not modified!
                    continue;
                }

                stack.Push(childProperty.FolderName);
                CompareNodeChildren(original, @new, changes, stack, childProperty);
                stack.Pop();
            }
        }