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


C# Topic.FetchContent方法代码示例

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


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

示例1: UrlToStream

        public Stream UrlToStream(String sURL, Boolean okToRender)
        {
            if (MsxhelpProtocol.Catalog == null || !MsxhelpProtocol.Catalog.IsOpen)
                return null;

            HelpQuery helpQuery;
            URLType urltype = UrlInfo(sURL, out helpQuery);
            String url = sURL.Replace("&", "&");

            Stream stream = null;
            String assetPath = "";
            CatalogRead _catalogRead = new CatalogRead();

            // Indexed Topic -- ms-xhelp:///?method=page&id=SouthPark.Index&vendor=ACME Company&topicVersion=-1&topicLocale=EN-US
            // or an unrendered url: ms-xhelp:///?Id=SouthPark.EricCartman

            if (urltype == URLType.Topic)
            {
                _helpQuery = new HelpQuery(helpQuery.ToString());

                HelpFilter filter = new HelpFilter();
                if (!String.IsNullOrEmpty(_helpQuery.Vendor))
                    filter.Add("vendor", _helpQuery.Vendor);
                if (!String.IsNullOrEmpty(_helpQuery.TopicLocale))
                    filter.Add("topiclocale", _helpQuery.TopicLocale);
                if (!String.IsNullOrEmpty(_helpQuery.TopicVersion))
                    filter.Add("topicversion", _helpQuery.TopicVersion);

                //Get topic obj frome store
                String [] root = _helpQuery.AssetId.Split(new String[] {"%7c"}, StringSplitOptions.None);
                if (root.Length == 1)
                {
                    _topic = (Topic)_catalogRead.GetIndexedTopicDetails(MsxhelpProtocol.Catalog, _helpQuery.AssetId, filter);
                }
                else if (root.Length == 3 && root[0] == "VS")
                {
                    String[] path = root[2].Split(new string[] {"%5c"}, StringSplitOptions.None);
                    if (root[1] == "winui")
                    {
                        // Create keyword list
                        String name = path[path.Length-1];
                        if (name.IndexOf(".") != -1)
                            name = name.Substring(0, name.IndexOf("."));
                        String[] prioritizedF1Keywords = new String[1];
                        prioritizedF1Keywords[0] = "winuser/" + name;

                        //Get topic obj frome store
                        _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter);

                    }
                }
                if (_topic != null)
                {
                    // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package)
                    String[] url2 = _topic.Url.Split(new char[] { ';' });
                    if (url2.Length > 0)
                        helpQuery.Package = url2[0];   // "package.mshc"
                    _helpQuery.Package = helpQuery.Package;

                    if (!String.IsNullOrEmpty(_topic.Locale))
                        _helpQuery.Locale = _topic.Locale;
                    if (String.IsNullOrEmpty(_helpQuery.Locale))
                        _helpQuery.Locale = MSLocales.ThreadLocale;

                    if (!String.IsNullOrEmpty(_topic.TopicLocale))
                        _helpQuery.TopicLocale = _topic.TopicLocale;
                    if (!String.IsNullOrEmpty(_topic.TopicVersion))
                        _helpQuery.TopicVersion = _topic.TopicVersion;
                    if (!String.IsNullOrEmpty(_topic.Vendor))
                        _helpQuery.Vendor = _topic.Vendor;

                    //Special Case: Force modified text
                    if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText))
                    {
                        stream = MsxhelpProtocol.GetUserTopicAsStream();
                    }
                    else
                    {
                        try
                        {
                            stream = (Stream)_topic.FetchContent();    //Normal fetch topic from store
                            //this would also return the stream
                            //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null);
                        }
                        catch
                        {
                            stream = null;
                        }
                    }
                    if (stream != null && okToRender)
                    {
                        new TopicStreamExpand(stream, helpQuery);   // expand all links etc in the stream
                    }
                }
            }

            // F1Keyword query "ms-xhelp:///?method=f1&query=SouthPark.Text"

            else if (urltype == URLType.F1Keyword)
            {
//.........这里部分代码省略.........
开发者ID:bencz,项目名称:OrangeC,代码行数:101,代码来源:CustomRenderer.cs


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