Esempio n. 1
0
        public virtual void Add(System.Collections.IEnumerable keys, object value)
        {
            object key = car(keys);

            System.Collections.IList keys2 = cdr(keys);

            if (keys2.Count == 0)
            {
                if (this._nodes.ContainsKey(key))
                {
                    this._nodes[key] = new SortingTree(key.ToString(), value);
                }
                else
                {
                    this._nodes.Add(key, new SortingTree(key.ToString(), value));
                }
            }
            else
            {
                if (this._nodes.ContainsKey(key))
                {
                    ((SortingTree)this._nodes[key]).Add(keys2, value);
                }
                else
                {
                    SortingTree node = new SortingTree(key.ToString());
                    node.Add(keys2, value);
                    this._nodes.Add(key, node);
                }
            }
        }
Esempio n. 2
0
        private bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode CreateCSharpProjectTreeNode(string path)
        {
            if (Bamboo.VisualStudio.CSharpProjectDetector.Is2005(path))
            {
                Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project project         = Bamboo.VisualStudio.VisualStudio2005.CSharpProject.ProjectReader.Read(path);
                bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode         projectTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode(project.Name, path, project, Images.CSharpProject);
                foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Reference reference in project.References)
                {
                    bamboo.Controls.ProjectExplorer.TreeNodes.FileReferenceTreeNode fileReferenceTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.FileReferenceTreeNode(reference.Include, reference.HintPath);
                    projectTreeNode.References.Add(fileReferenceTreeNode);
                }
                foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.ProjectReference projectReference in project.ProjectReferences)
                {
                    bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode projectReferenceTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode(projectReference.Name);
                    projectTreeNode.References.Add(projectReferenceTreeNode);
                }
                SortingTree fileTree = new SortingTree();
                foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item item in project.Items)
                {
                    string[] keys = item.Include.Split("\\".ToCharArray());
                    fileTree.Add(keys, item);
                }
                string rootPath = path.Substring(0, path.LastIndexOf("\\"));
                foreach (SortingTree node in fileTree.Nodes)
                {
                    if (node.IsLeaf())
                    {
                        Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item item = (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item)node.Value;
                        projectTreeNode.Add(new bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode(node.Name, rootPath + "\\" + item.Include, GetImage(node.Name)));
                    }
                    else
                    {
                        projectTreeNode.Add(CreateCSharpProjectFolderTreeNode(node, rootPath));
                    }
                }
                return(projectTreeNode);
            }
//            else if (Bamboo.VisualStudio.CSharpProjectDetector.Is2003(path))
//            {
//                Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Project project = Bamboo.VisualStudio.VisualStudio2003.CSharpProject.ProjectReader.Read(path);
//                bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode projectTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode(project.Name, path, project, Images.CSharpProject);
//                foreach (Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Reference reference in project.References)
//                {
//                    int n = 0;
////					bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode projectReferenceTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode();
//                }
//                Bamboo.Trees.Tree fileTree = new Bamboo.Trees.Tree();
//                foreach (Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Item item in project.Items)
//                {
////					bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode fileTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode();
//                    int n = 0;

//                    string[] keys = item.RelPath.Split("\\".ToCharArray());
//                    fileTree.Add(keys, item);
//                }
//                return projectTreeNode;
//            }
            else
            {
                throw new System.Exception("Invalid project version.");
            }
        }