本文整理汇总了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));
}
示例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));
}
示例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();
}