当前位置: 首页>>代码示例>>C#>>正文


C# HierarchyNode.AddChild方法代码示例

本文整理汇总了C#中HierarchyNode.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode.AddChild方法的具体用法?C# HierarchyNode.AddChild怎么用?C# HierarchyNode.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HierarchyNode的用法示例。


在下文中一共展示了HierarchyNode.AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddDirectory

 /// <summary>
 /// Adds a directory to the project hierarchy with the specified parent.
 /// </summary>
 protected void AddDirectory(HierarchyNode parent, bool isSearchPath, string subfolder) {
     var existing = parent.FindChild(Path.GetFileName(subfolder));
     if (existing == null) {
         FolderNode folderNode = CreateFolderNode(subfolder);
         parent.AddChild(folderNode);
         CreateHierarchy(folderNode, subfolder, isSearchPath);
     }
 }
开发者ID:jschementi,项目名称:iron,代码行数:11,代码来源:DirectoryBasedProjectNode.cs

示例2: ReplaceCore

 private static HierarchyNode ReplaceCore(RustProjectNode root, HierarchyNode old, Func<HierarchyNode> newN, HierarchyNode parent)
 {
     HierarchyNode newNode = newN();
     while (old.FirstChild != null)
     {
         HierarchyNode current = old.FirstChild;
         root.ProjectMgr.OnItemDeleted(current);
         old.RemoveChild(current);
         current.ID = root.ProjectMgr.ItemIdMap.Add(current);
         newNode.AddChild(current);
     }
     TreeOperations.RemoveSubnodeFromHierarchy(root, old, false);
     parent.AddChild(newNode);
     return newNode;
 }
开发者ID:whuthj,项目名称:VisualRust,代码行数:15,代码来源:TreeOperations.cs

示例3: AddNewFileNodeToHierarchy

        /// <summary>
        /// Adds a new file node to the hierarchy.
        /// </summary>
        /// <param name="parentNode">The parent of the new fileNode</param>
        /// <param name="fileName">The file name</param>
        protected virtual void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string fileName)
        {
            if (parentNode == null)
            {
                throw new ArgumentNullException("parentNode");
            }

            HierarchyNode child;

            // In the case of subitem, we want to create dependent file node
            // and set the DependentUpon property
            if (this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
            {
                child = this.CreateDependentFileNode(fileName);
                child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));

                // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
                if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
                {
                    child.HasParentNodeNameRelation = true;
                }
            }
            else
            {
                //Create and add new filenode to the project
                child = this.CreateFileNode(fileName);
            }

            parentNode.AddChild(child);

            // TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project?
            this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
        }
开发者ID:IntelliTect,项目名称:PowerStudio,代码行数:38,代码来源:ProjectNode.cs

示例4: BuildModuleHierarchy

        private IEnumerable<IPackage> BuildModuleHierarchy(HierarchyNode parent, IEnumerable<IPackage> modules, IReadOnlyDictionary<string, DependencyNode> recycle)
        {
            if (modules == null) {
                return Enumerable.Empty<IPackage>();
            }

            var newModules = new List<IPackage>();
            foreach (var package in modules) {
                DependencyNode child;
                if (recycle.ContainsKey(package.Name)) {
                    child = recycle[package.Name];
                    child.Package = package;
                } else {
                    child = new DependencyNode(_projectNode, parent as DependencyNode, package);
                    parent.AddChild(child);
                    newModules.Add(package);
                }

                ReloadHierarchy(child, package.Modules);
                if (ProjectMgr.ParentHierarchy != null) {
                    child.ExpandItem(EXPANDFLAGS.EXPF_CollapseFolder);
                }
            }
            return newModules;
        }
开发者ID:xeronith,项目名称:nodejstools,代码行数:25,代码来源:AbstractNpmNode.cs

示例5: GetOrAddDirectory

 private HierarchyNode GetOrAddDirectory(HierarchyNode node, List<KeyValuePair<HierarchyNode, HierarchyNode>> addedItems, string dir) {
     var existingDir = node.FindImmediateChildByName(Path.GetFileName(dir));
     if (existingDir == null) {
         existingDir = CreateFolderNode(dir);
         addedItems.Add(new KeyValuePair<HierarchyNode, HierarchyNode>(node, existingDir));
         node.AddChild(existingDir);
     }
     return existingDir;
 }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:9,代码来源:ProjectNode.CopyPaste.cs

示例6: AddExistingDirectory

        private void AddExistingDirectory(HierarchyNode node, string path, List<KeyValuePair<HierarchyNode, HierarchyNode>> addedItems) {
            foreach (var dir in Directory.GetDirectories(path)) {
                var existingDir = GetOrAddDirectory(node, addedItems, dir);

                AddExistingDirectory(existingDir, dir, addedItems);
            }

            foreach (var file in Directory.GetFiles(path)) {
                var existingFile = node.FindImmediateChildByName(Path.GetFileName(file));
                if (existingFile == null) {
                    existingFile = CreateFileNode(file);
                    addedItems.Add(new KeyValuePair<HierarchyNode, HierarchyNode>(node, existingFile));
                    node.AddChild(existingFile);
                }
            }
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:16,代码来源:ProjectNode.CopyPaste.cs

示例7: ReloadHierarchy

        protected void ReloadHierarchy(HierarchyNode parent, IEnumerable<IPackage> modules) {
            //  We're going to reuse nodes for which matching modules exist in the new set.
            //  The reason for this is that we want to preserve the expansion state of the
            //  hierarchy. If we just bin everything off and recreate it all from scratch
            //  it'll all be in the collapsed state, which will be annoying for users who
            //  have drilled down into the hierarchy
            var recycle = new Dictionary<string, DependencyNode>();
            var remove = new List<HierarchyNode>();
            for (var current = parent.FirstChild; null != current; current = current.NextSibling) {
                var dep = current as DependencyNode;
                if (null == dep) {
                    if (!(current is GlobalModulesNode) && !(current is LocalModulesNode)) {
                        remove.Add(current);
                    }
                    continue;
                }

                if (modules != null && modules.Any(
                    module =>
                        module.Name == dep.Package.Name
                        && module.Version == dep.Package.Version
                        && module.IsBundledDependency == dep.Package.IsBundledDependency
                        && module.IsDevDependency == dep.Package.IsDevDependency
                        && module.IsListedInParentPackageJson == dep.Package.IsListedInParentPackageJson
                        && module.IsMissing == dep.Package.IsMissing
                        && module.IsOptionalDependency == dep.Package.IsOptionalDependency)) {
                    recycle[dep.Package.Name] = dep;
                } else {
                    remove.Add(current);
                }
            }

            foreach (var obsolete in remove) {
                parent.RemoveChild(obsolete);
                ProjectMgr.OnItemDeleted(obsolete);
            }

            if (modules != null) {
                foreach (var package in modules) {
                    DependencyNode child;

                    if (recycle.ContainsKey(package.Name)) {
                        child = recycle[package.Name];
                        child.Package = package;
                    }
                    else {
                        child = new DependencyNode(_projectNode, parent as DependencyNode, package);
                        parent.AddChild(child);
                    }

                    ReloadHierarchy(child, package.Modules);
                    if (ProjectMgr.ParentHierarchy != null) {
                        child.ExpandItem(EXPANDFLAGS.EXPF_CollapseFolder);
                    }
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:57,代码来源:AbstractNpmNode.cs

示例8: AddFileNodeToNode

 /// <summary>
 /// Add a file node to the hierarchy
 /// </summary>
 /// <param name="item">msbuild item to add</param>
 /// <param name="parentNode">Parent Node</param>
 /// <returns>Added node</returns>
 private HierarchyNode AddFileNodeToNode(MSBuild.ProjectItem item, HierarchyNode parentNode)
 {
     FileNode node = this.CreateFileNode(new ProjectElement(this, item, false));
     parentNode.AddChild(node);
     return node;
 }
开发者ID:IntelliTect,项目名称:PowerStudio,代码行数:12,代码来源:ProjectNode.cs

示例9: AddDirectory

        /// <summary>
        /// Adds a folder into the project recursing and adding any sub-files and sub-directories.
        /// 
        /// The user can be prompted to overwrite the existing files if the folder already exists
        /// in the project.  They will be initially prompted to overwrite - if they answer no t
        /// we'll set promptOverwrite to false and when we recurse we won't prompt.  If they say
        /// yes then we'll set it to true and we will prompt for individual files.  
        /// </summary>
        private int AddDirectory(VSADDRESULT[] result, HierarchyNode n, string file, bool? promptOverwrite)
        {
            // need to recursively add all of the directory contents
            var fullPath = Path.Combine(GetBaseDirectoryForAddingFiles(n), Path.GetFileName(file));
            HierarchyNode targetFolder = n.FindChild(fullPath, false);
            if (targetFolder == null)
            {

                var newChild = CreateFolderNode(fullPath);
                n.AddChild(newChild);
                targetFolder = newChild;
            }
            else if (promptOverwrite == null)
            {
                var res = MessageBox.Show(
                    String.Format(
                    @"This folder already contains a folder called '{0}'.

            If the files in the existing folder have the same names as files in the folder you are copying, do you want to replace the existing files?", Path.GetFileName(file)),
                    "Merge Folders",
                    MessageBoxButtons.YesNoCancel
                );

                // yes means prompt for each file
                // no means don't prompt for any of the files
                // cancel means forget what I'm doing

                switch (res)
                {
                    case DialogResult.Cancel:
                        result[0] = VSADDRESULT.ADDRESULT_Cancel;
                        return (int)OleConstants.OLECMDERR_E_CANCELED;
                    case DialogResult.No:
                        promptOverwrite = false;
                        return VSConstants.S_OK;
                    case DialogResult.Yes:
                        promptOverwrite = true;
                        break;
                }
            }

            // add the files...
            var dirFiles = Directory.GetFiles(file);
            Guid empty = Guid.Empty;

            var subRes = AddItemWithSpecificInternal(
                targetFolder.ID,
                VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE,
                null,
                (uint)dirFiles.Length,
                dirFiles,
                IntPtr.Zero,
                0,
                ref empty,
                null,
                ref empty,
                result,
                promptOverwrite: promptOverwrite
            );

            if (ErrorHandler.Failed(subRes))
            {
                return subRes;
            }

            // add any subdirectories...

            var subDirs = Directory.GetDirectories(file);

            return AddItemWithSpecificInternal(
                targetFolder.ID,
                VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE,
                null,
                (uint)subDirs.Length,
                subDirs,
                IntPtr.Zero,
                0,
                ref empty,
                null,
                ref empty,
                result,
                promptOverwrite: promptOverwrite
            );
        }
开发者ID:happylancer,项目名称:node-tools,代码行数:92,代码来源:ProjectNode.cs

示例10: AddNewFileNodeToHierarchy

        // KLiss: body of this method is copy/pasted from base one (and modified),
        // as base implementation does not allow changing parent node on-the-fly.
        protected override void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string fileName)
        {
            HierarchyNode child;
            HierarchyNode newParent;

            // KLiss: try to find possible parent file (ie, Form3.n would be parent for Form3.designer.n
            bool parentFound = TryFindParentFileNode(parentNode, fileName, out newParent);
            if (parentFound)
            {
                parentNode = newParent;

                // KLiss: when file is added to project, it is treated as code file,
                // regardless of SubType value, specified in the template.
                // SubType is assigned correct value later, and now we will make another
                // attempt to find out, whether it is OK for an item to have designer, or not.
                var nemerleParent = parentNode as NemerleFileNode;
                if (nemerleParent != null)
                {
                    nemerleParent.InferHasDesignerFromSubType();
                }
            }

            // In the case of subitem, we want to create dependent file node
            // and set the DependentUpon property
            if (parentFound || parentNode is FileNode || parentNode is DependentFileNode)
            {
                child = this.CreateDependentFileNode(fileName);

                child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));

                // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
                if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
                {
                    child.HasParentNodeNameRelation = true;
                }
            }
            else
            {
                //Create and add new filenode to the project
                child = this.CreateFileNode(fileName);
            }

            parentNode.AddChild(child);

            var projectInfo = ProjectInfo;

            if (projectInfo != null)
                projectInfo.Engine.RequestOnBuildTypesTree();

            //// TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project?
            //this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
        }
开发者ID:vestild,项目名称:nemerle,代码行数:54,代码来源:NemerleProjectNode.cs

示例11: AddNewLinkedFileNodeToHierarchy

        // !EFW
        /// <summary>
        /// Adds a new linked file node to the hierarchy.
        /// </summary>
        /// <param name="parentNode">The parent of the new fileNode</param>
        /// <param name="linkedFileName">The linked filename</param>
        /// <param name="fileName">The file name in the project heirarchy</param>
        protected virtual void AddNewLinkedFileNodeToHierarchy(
          HierarchyNode parentNode, string linkedFileName, string fileName)
        {
            // NOTE: The general process should match that of
            // AddNewFileNodeToHierarchy with the exception of the filename
            // used and the addition of the Link metadata.
            HierarchyNode child;

            // In the case of subitem, we want to create dependent file node
            // and set the DependentUpon property
            if(this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
            {
                child = this.CreateDependentFileNode(linkedFileName);
                child.ItemNode.SetMetadata(ProjectFileConstants.Link,
                    PackageUtilities.MakeRelative(base.ProjectMgr.FileName, fileName));
                child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon,
                    parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));

                // Make sure to set the HasNameRelation flag on the dependent
                // node if it is related to the parent by name
                if(!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(),
                  parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
                {
                    child.HasParentNodeNameRelation = true;
                }
            }
            else
            {
                //Create and add new filenode to the project
                child = this.CreateFileNode(linkedFileName);
                child.ItemNode.SetMetadata(ProjectFileConstants.Link,
                    PackageUtilities.MakeRelative(base.ProjectMgr.FileName, fileName));
            }

            parentNode.AddChild(child);

            // TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project?
            this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:46,代码来源:ProjectNode.cs

示例12: AddNewScript

        public virtual int AddNewScript(HierarchyNode parent)
        {
            string new_name = "NewScript";
            int marker = 1;
            string name = new_name + marker.ToString() + ".ctl";
            while (!Utilities.IsNameUniqueInFirstLevelOfNode(this, name) && marker < 100)
            {
                ++marker;
                name = new_name + marker.ToString() + ".ctl";
            }
            if (marker < 100)
            {
                System.IO.File.Create(ProjectMgr.ProjectFolder + "\\" + name);
                CogaenEditFile file = new CogaenEditFile(name, this.ProjectMgr, null);
                parent.AddChild(file);
                IVsUIHierarchyWindow uiWindow = UIHierarchyUtilities.GetUIHierarchyWindow(this.ProjectMgr.Site, SolutionExplorer);
                // This happens in the context of adding a new folder.
                // Since we are already in solution explorer, it is extremely unlikely that we get a null return.
                // If we do, the newly created folder will not be selected, and we will not attempt the rename
                // command (since we are selecting the wrong item).
                if (uiWindow != null)
                {
                    // we need to get into label edit mode now...
                    // so first select the new guy...
                    int result = uiWindow.ExpandItem(this.ProjectMgr, file.ID, EXPANDFLAGS.EXPF_SelectItem);
                    ErrorHandler.ThrowOnFailure(result);
                    // them post the rename command to the shell. Folder verification and creation will
                    // happen in the setlabel code...
                    IVsUIShell shell = this.ProjectMgr.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;

                    Debug.Assert(shell != null, "Could not get the ui shell from the project");
                    if (shell == null)
                    {
                        return VSConstants.E_FAIL;
                    }

                    object dummy = null;
                    Guid cmdGroup = VsMenus.guidStandardCommandSet97;
                    ErrorHandler.ThrowOnFailure(shell.PostExecCommand(ref cmdGroup, (uint)VsCommands.Rename, 0, ref dummy));
                }
                return VSConstants.S_OK;
            }
            else
                return VSConstants.E_FAIL;
        }
开发者ID:DelBero,项目名称:XnaScrapEdit,代码行数:45,代码来源:CogaenEditProject.cs

示例13: BuildTree

        /// <summary>
        /// Описание иерархии
        /// </summary>
        /// <param name="joints"></param>
        /// <returns></returns>
        private static HierarchyNode BuildTree(JointCollection joints)
        {
            var root = new HierarchyNode(new SkeletonPoint(), JointType.HipCenter, ConstBodyPoints.Hips);
            HierarchyNode node = null;

            //Ветка: Корень - Левая часть рутового креста - Левое бедро - левая коленка - левая лодыжка - Энд сайт(Также пусть будет лодыжка)
            node = root.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.CrossLeft, ConstBodyPoints.LeftCross));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HipLeft, ConstBodyPoints.LeftHip));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.KneeLeft, ConstBodyPoints.LeftKnee));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.AnkleLeft, ConstBodyPoints.LeftAnkle));
            node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.FootLeft, ConstBodyPoints.Site));

            //Ветка: Корень - Правое бедро - правая коленка - правая лодыжка - Энд сайт
            node = root.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.CrossRight, ConstBodyPoints.RightCross));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HipRight, ConstBodyPoints.RightHip));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.KneeRight, ConstBodyPoints.RightKnee));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.AnkleRight, ConstBodyPoints.RightAnkle));
            node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.FootRight, ConstBodyPoints.Site));

            //Ветка: Корень - Верхняя часть рутового креста - Поясница - Левая ключица - Левое плечо - Левый локоть - Левая кисть - Энд сайт
            node = root.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.CrossUp, ConstBodyPoints.UpCross));
            var chestNode = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.Spine, ConstBodyPoints.Chest));

            node = chestNode.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderCenter, ConstBodyPoints.LeftCollar));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderLeft, ConstBodyPoints.LeftShoulder));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ElbowLeft, ConstBodyPoints.LeftElbow));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.WristLeft, ConstBodyPoints.LeftWrist));
            node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HandLeft, ConstBodyPoints.Site));

            //Ветка:Поясница - Левая ключица - Левое плечо - Левый локоть - Левая кисть - Энд сайт
            node = chestNode.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderCenter, ConstBodyPoints.RightCollar));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderRight, ConstBodyPoints.RightShoulder));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ElbowRight, ConstBodyPoints.RightElbow));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.WristRight, ConstBodyPoints.RightWrist));
            node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.HandRight, ConstBodyPoints.Site));

            //Ветка: Шея - Средняя точка головы - Энд Сайт
            node = chestNode.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.ShoulderCenter, ConstBodyPoints.Neck));
            node = node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.Head, ConstBodyPoints.Head));
            node.AddChild(new HierarchyNode(new SkeletonPoint(), JointType.Head, ConstBodyPoints.Site));

            return root;
        }
开发者ID:scherbinin,项目名称:Kinect,代码行数:48,代码来源:BvhCreater.cs

示例14: VerifySubFolderExists

        protected virtual FolderNode VerifySubFolderExists(string path, HierarchyNode parent)
        {
            FolderNode folderNode = null;
            uint uiItemId;
            Url url = new Url(this.BaseURI, path);
            string strFullPath = url.AbsoluteUrl;
            // Folders end in our storage with a backslash, so add one...
            this.ParseCanonicalName(strFullPath, out uiItemId);
            if (uiItemId != (uint)VSConstants.VSITEMID.Nil)
            {
                Debug.Assert(this.NodeFromItemId(uiItemId) is FolderNode, "Not a FolderNode");
                folderNode = (FolderNode)this.NodeFromItemId(uiItemId);
            }

            if (folderNode == null && path != null && parent != null)
            {
                // folder does not exist yet...
                // We could be in the process of loading so see if msbuild knows about it
                ProjectElement item = null;
                foreach (MSBuild.ProjectItem folder in buildProject.GetItems(ProjectFileConstants.Folder))
                {
                    if (String.Compare(folder.EvaluatedInclude.TrimEnd('\\'), path.TrimEnd('\\'), StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        item = new ProjectElement(this, folder, false);
                        break;
                    }
                }
                // If MSBuild did not know about it, create a new one
                if (item == null)
                    item = this.AddFolderToMsBuild(path);
                folderNode = this.CreateFolderNode(path, item);
                parent.AddChild(folderNode);
            }

            return folderNode;
        }
开发者ID:IntelliTect,项目名称:PowerStudio,代码行数:36,代码来源:ProjectNode.cs

示例15: AddFile

 /// <summary>
 /// Adds a file to the project hierarchy with the specified parent.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="isSearchPath"></param>
 /// <param name="file"></param>
 protected void AddFile(HierarchyNode parent, bool isSearchPath, string file) {
     var existing = parent.FindChild(file);
     if (existing == null) {
         FileNode fileNode = CreateFileNode(file);
         //Files in search path are not considered memebers of the project itself
         fileNode.SetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem, isSearchPath);
         parent.AddChild(fileNode);
     }
 }
开发者ID:jschementi,项目名称:iron,代码行数:15,代码来源:DirectoryBasedProjectNode.cs


注:本文中的HierarchyNode.AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。