Beispiel #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is SortingTree))
            {
                return(false);
            }

            SortingTree tree = (SortingTree)obj;

            if (!this.Name.Equals(tree.Name))
            {
                return(false);
            }
            if (!this.Value.Equals(tree.Value))
            {
                return(false);
            }
            if (this.Nodes.Count != tree.Nodes.Count)
            {
                return(false);
            }

            foreach (SortingTree node in tree.Nodes)
            {
                SortingTree node2 = (SortingTree)this._nodes[node.Name];
                if (!node.Equals(node2))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
0
        public virtual object Lookup(System.Collections.IEnumerable keys)
        {
            object key = car(keys);

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

            if (keys2.Count == 0)
            {
                if (this._nodes.ContainsKey(key))
                {
                    SortingTree tree = (SortingTree)this._nodes[key];
                    if (tree.Nodes.Count > 0)
                    {
                        return(tree);
                    }
                    else
                    {
                        return(tree.Value);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                if (this._nodes.ContainsKey(key))
                {
                    return(((SortingTree)this._nodes[key]).Lookup(keys2));
                }
                else
                {
                    return(null);
                }
            }
        }
 private bamboo.Controls.ProjectExplorer.TreeNodes.FolderTreeNode CreateCSharpProjectFolderTreeNode(SortingTree tree, string rootPath)
 {
     bamboo.Controls.ProjectExplorer.TreeNodes.FolderTreeNode folderTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.FolderTreeNode(tree.Name);
     foreach (SortingTree node in tree.Nodes)
     {
         if (node.IsLeaf())
         {
             Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item item = (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item)node.Value;
             folderTreeNode.Add(new bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode(node.Name, rootPath + "\\" + item.Include, GetImage(node.Name)));
         }
         else
         {
             folderTreeNode.Add(CreateCSharpProjectFolderTreeNode(node, rootPath));
         }
     }
     return(folderTreeNode);
 }
        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.");
            }
        }