HeaderToTree() public method

public HeaderToTree ( ) : TreeNode
return System.Windows.Forms.TreeNode
Esempio n. 1
0
        private void FaceFXRefresh(int n)
        {
            IEnumerable <string> expandedNodes = null;
            string topNodeName = null;

            if (FaceFX != null && n == FaceFX.export.Index)
            {
                List <TreeNode> allNodes = treeView2.Nodes.Cast <TreeNode>().ToList();
                //flatten tree of nodes into list.
                for (int j = 0; j < allNodes.Count(); j++)
                {
                    allNodes.AddRange(allNodes[j].Nodes.Cast <TreeNode>());
                }
                expandedNodes = allNodes.Where(x => x.IsExpanded).Select(x => x.Name);
                topNodeName   = treeView2.TopNode.Name;
            }
            IExportEntry exportEntry = pcc.Exports[n];

            FaceFX           = new ME3FaceFXAnimSet(pcc, exportEntry);
            hb1.ByteProvider = new DynamicByteProvider(exportEntry.Data);
            treeView1.Nodes.Clear();
            treeView1.Nodes.Add(FaceFX.HeaderToTree());
            nameAllNodes(treeView1.Nodes);
            treeView2.Nodes.Clear();
            treeView2.Nodes.Add(FaceFX.DataToTree());
            nameAllNodes(treeView2.Nodes);
            TreeNode[] nodes;
            if (expandedNodes != null)
            {
                foreach (string item in expandedNodes)
                {
                    nodes = treeView2.Nodes.Find(item, true);
                    if (nodes.Length > 0)
                    {
                        foreach (var node in nodes)
                        {
                            node.Expand();
                        }
                    }
                }
            }
            nodes = treeView2.Nodes.Find(topNodeName, true);
            if (nodes.Length > 0)
            {
                treeView2.TopNode = nodes[0];
            }
        }
        private void FaceFXRefresh(int n)
        {
            IEnumerable<string> expandedNodes = null;
            string topNodeName = null;
            if (FaceFX != null && n == FaceFX.export.Index)
            {
                List<TreeNode> allNodes = treeView2.Nodes.Cast<TreeNode>().ToList();
                //flatten tree of nodes into list.
                for (int j = 0; j < allNodes.Count(); j++)
                {
                    allNodes.AddRange(allNodes[j].Nodes.Cast<TreeNode>());
                }
                expandedNodes = allNodes.Where(x => x.IsExpanded).Select(x => x.Name);
                topNodeName = treeView2.TopNode.Name;

            }
            IExportEntry exportEntry = pcc.Exports[n];
            FaceFX = new ME3FaceFXAnimSet(pcc, exportEntry);
            hb1.ByteProvider = new DynamicByteProvider(exportEntry.Data);
            treeView1.Nodes.Clear();
            treeView1.Nodes.Add(FaceFX.HeaderToTree());
            nameAllNodes(treeView1.Nodes);
            treeView2.Nodes.Clear();
            treeView2.Nodes.Add(FaceFX.DataToTree());
            nameAllNodes(treeView2.Nodes);
            TreeNode[] nodes;
            if (expandedNodes != null)
            {
                foreach (string item in expandedNodes)
                {
                    nodes = treeView2.Nodes.Find(item, true);
                    if (nodes.Length > 0)
                    {
                        foreach (var node in nodes)
                        {
                            node.Expand();
                        }
                    }
                }
            }
            nodes = treeView2.Nodes.Find(topNodeName, true);
            if (nodes.Length > 0)
            {
                treeView2.TopNode = nodes[0];
            }
        }