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


C# IFilter.Init方法代码示例

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


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

示例1: InitIFilter

 private static IFilter InitIFilter(IFilter filter)
 {
     IFILTER_FLAGS flags;
     var iflags =
                 IFILTER_INIT.IFILTER_INIT_CANON_HYPHENS |
                 IFILTER_INIT.IFILTER_INIT_CANON_PARAGRAPHS |
                 IFILTER_INIT.IFILTER_INIT_CANON_SPACES |
                 IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES |
                 IFILTER_INIT.IFILTER_INIT_HARD_LINE_BREAKS |
                 IFILTER_INIT.IFILTER_INIT_FILTER_OWNED_VALUE_OK;
     var returnCodes = filter.Init(iflags, 0, null, out flags);
     if (returnCodes == Constants.S_OK)
         return filter;
     Marshal.ReleaseComObject(filter);
     throw new Exception(string.Format("Init failed, returnCodes : {0}", returnCodes));
 }
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:16,代码来源:FilterLoader.cs

示例2: InitializeFilter

        private static void InitializeFilter(string path, IFilter filter)
        {
            const FilterSettings iflags = FilterSettings.CanonHyphens
                                        | FilterSettings.CanonParagraphs
                                        | FilterSettings.CanonSpaces
                                        | FilterSettings.ApplyCrawlAttributes
                                        | FilterSettings.ApplyIndexAttributes
                                        | FilterSettings.ApplyOtherAttributes
                                        | FilterSettings.HardLineBreaks
                                        | FilterSettings.SearchLinks
                                        | FilterSettings.FilterOwnedValueOk;

            uint i = 0;
            if (filter.Init(iflags, 0, null, ref i) != (int)FilterReturnCodes.Success)
                throw new Exception(string.Format("Could not initialize an IFilter for: '{0}'", path));
        }
开发者ID:JoakimBrannstrom,项目名称:TextExtractor,代码行数:16,代码来源:TextExtractor.cs

示例3: ExtractText

        private static string ExtractText(IFilter filter)
        {
            var plainTextResult = new StringBuilder();
            var ps = new STAT_CHUNK();
            IFILTER_INIT mFlags = 0;

            uint i = 0;
            filter.Init(mFlags, 0, null, ref i);

            int resultChunk = 0;

            resultChunk = filter.GetChunk(out ps);
            while (resultChunk == 0)
            {
                if (ps.flags == CHUNKSTATE.CHUNK_TEXT)
                {
                    uint sizeBuffer = 60000;
                    var resultText = 0;
                    while (resultText == Constants.FILTER_S_LAST_TEXT || resultText == 0)
                    {
                        sizeBuffer = 60000;
                        var sbBuffer = new StringBuilder((int)sizeBuffer);
                        resultText = filter.GetText(ref sizeBuffer, sbBuffer);

                        if (sizeBuffer > 0 && sbBuffer.Length > 0)
                        {
                            string chunk = sbBuffer.ToString(0, (int)sizeBuffer);
                            plainTextResult.Append(chunk);
                        }
                    }
                }
                resultChunk = filter.GetChunk(out ps);
            }
            return plainTextResult.ToString();
        }
开发者ID:ralreegorganon,项目名称:Indexzor,代码行数:35,代码来源:Parser.cs


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