コード例 #1
0
        private void BuildFileTree(string fileName, CSVFile csv)
        {
            TreeNode fileNode = new TreeNode(fileName);

            int    lineI = 0;
            string type;
            string item;

            while (true)
            {
                type = csv.GetValueByLine(lineI, 0);
                item = csv.GetValueByLine(lineI, 1);
                lineI++;

                if (type == null || type == "")
                {
                    break;
                }

                TreeNode itemNode = new TreeNode(item);
                itemNode.Name = item;

                TreeNode overwriteNode;
                if (IsOverwrite(type, item, out overwriteNode))
                {
                    itemNode.ForeColor      = Color.Blue;
                    overwriteNode.ForeColor = Color.Blue;
                    this.totalOverwrites++;
                }

                TreeNode typeNode = fileNode.FindByName(type);
                if (typeNode == null)
                {
                    typeNode      = new TreeNode(type);
                    typeNode.Name = type;
                    fileNode.Nodes.Add(typeNode);
                }

                typeNode.Nodes.Add(itemNode);
            }

            fileNode.Sort();

            foreach (TreeNode n in fileNode.Nodes)
            {
                n.Text = n.Text + " (" + n.Nodes.Count + ")";
                n.Sort();
            }

            this.AssetTree.Nodes.Add(fileNode);
        }