Пример #1
0
        public void Undo()
        {
            Debug.Assert(infos != null);
            if (infos == null)
            {
                throw new InvalidOperationException();
            }

            for (int i = infos.Length - 1; i >= 0; i--)
            {
                var info = infos[i];

                for (int j = info.Namespaces.Length - 1; j >= 0; j--)
                {
                    var  typeNode = nsTarget.RemoveLast();
                    bool b        = info.TypeNodes.Nodes[j] == typeNode;
                    Debug.Assert(b);
                    if (!b)
                    {
                        throw new InvalidOperationException();
                    }
                    typeNode.TypeDefinition.Namespace = info.Namespaces[j];
                }

                info.TypeNodes.Restore();
            }

            nodes.Restore();

            infos = null;
        }
Пример #2
0
        public void Undo()
        {
            Debug.Assert(infos != null);
            if (infos == null)
            {
                throw new InvalidOperationException();
            }

            for (int i = infos.Length - 1; i >= 0; i--)
            {
                var info = infos[i];

                for (int j = info.Namespaces.Length - 1; j >= 0; j--)
                {
                    var typeNode = (TypeNode)nsTarget.TreeNode.Children[nsTarget.TreeNode.Children.Count - 1].Data;
                    nsTarget.TreeNode.Children.RemoveAt(nsTarget.TreeNode.Children.Count - 1);
                    bool b = info.TypeNodes.Nodes[j] == typeNode;
                    Debug.Assert(b);
                    if (!b)
                    {
                        throw new InvalidOperationException();
                    }
                    typeNode.TypeDef.Namespace = info.Namespaces[j];
                }

                info.TypeNodes.Restore();
            }

            nodes.Restore();

            foreach (var info in typeRefInfos)
            {
                info.TypeRef.Namespace = info.OrigNamespace;
            }

            infos = null;
        }
Пример #3
0
 public void Undo()
 {
     modelNodes.Restore(nodes.Nodes);
     nodes.Restore();
 }