Ejemplo n.º 1
0
        /// <summary>
        /// Registers the temporary rename.
        /// </summary>
        /// <param name="source">The renamed node.</param>
        protected void RegisterTemporaryRename(Node source)
        {
            TemporaryRenames.Add(source.Path, CurrentModel.Resolve(source.Path, true) as Node);

            var children = source.PropertyAccessors.Values
                           .Where(pa => !pa.IsImmutable).Select(pa => pa.Getter.Invoke(source));

            foreach (var child in children)
            {
                var childNode = child as Node;
                if (childNode != null)
                {
                    if (!TemporaryRenames.ContainsKey(childNode.Path))
                    {
                        var currentModelChildNode = CurrentModel.Resolve(childNode.Path) as Node;
                        if (currentModelChildNode != null)
                        {
                            TemporaryRenames.Add(childNode.Path, currentModelChildNode);
                        }
                    }
                    continue;
                }
                var childNodeCollection = child as NodeCollection;
                if (childNodeCollection != null)
                {
                    foreach (Node node in childNodeCollection)
                    {
                        if (!TemporaryRenames.ContainsKey(node.Path))
                        {
                            var currentModelChildNode = CurrentModel.Resolve(node.Path) as Node;
                            if (currentModelChildNode != null)
                            {
                                TemporaryRenames.Add(node.Path, currentModelChildNode);
                            }
                        }
                    }
                }
            }
        }