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


C# ApplicationClass.GetHierarchy方法代码示例

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


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

示例1: ProcessRecord

 protected override void ProcessRecord( )
 {
     if (ShouldProcess( _fullName ))
     {
         ApplicationClass _app = new ApplicationClass( );
         string objectId;
         _app.OpenHierarchy(_fullName, null, out objectId, CreateFileType.cftNone);
         string hierarchyXml;
         _app.GetHierarchy(objectId, HierarchyScope.hsSelf, out hierarchyXml);
         XmlDocument hierarchyDoc = new XmlDocument( );
         hierarchyDoc.LoadXml(hierarchyXml);
         string notebookName = hierarchyDoc.DocumentElement.Attributes["name"].Value;
         WriteObject("OneNote:\\" + notebookName);
     }
 }
开发者ID:c0ns0le,项目名称:OneNotePowerShellProvider,代码行数:15,代码来源:OpenCloseOneNote.cs

示例2: getOneNoteNode

        /// <summary>
        /// Gets the OneNote XML node that is associated with a "Path" of names that go:
        /// \Notebook\Section\Page
        /// </summary>
        /// <param name="path">The path to a OneNote organizational element.</param>
        /// <returns>An XML Node representing the element if it's found, or null otherwise.</returns>
        private XmlNode getOneNoteNode(string path)
        {
            //
            //  First, get the current hierarchy down to the page level.
            //

            string xml;
            ApplicationClass _app = new ApplicationClass( );
            _app.GetHierarchy(
                "",
                HierarchyScope.hsPages,
                out xml);
            XmlDocument hierarchy = new XmlDocument( );
            hierarchy.LoadXml(xml);

            if (PathIsDrive(path))
            {
                return hierarchy.DocumentElement;
            }

            //
            //  Next, split the path.
            //

            string[] pathComponents = splitPath(path);

            //
            //  Now, walk down the hierarchy looking at element names.
            //

            XmlNode currentElement = hierarchy.DocumentElement;
            foreach (string component in pathComponents)
            {
                currentElement = getChildNodeByName(currentElement, component);
                if (currentElement == null)
                {
                    return null;
                }
            }
            return currentElement;
        }
开发者ID:c0ns0le,项目名称:OneNotePowerShellProvider,代码行数:47,代码来源:OneNoteProvider.cs


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