internal static FilterWrapper LoadAndInitIFilter(string fileName, string extension) { FilterWrapper filter = LoadIFilter(extension); if (filter == null) { return(null); } IPersistFile persistFile = (filter.Filter as IPersistFile); if (persistFile != null) { persistFile.Load(fileName, 0); IFILTER_FLAGS flags; const IFILTER_INIT iflags = IFILTER_INIT.CANON_HYPHENS | IFILTER_INIT.CANON_PARAGRAPHS | IFILTER_INIT.CANON_SPACES | IFILTER_INIT.APPLY_INDEX_ATTRIBUTES | IFILTER_INIT.HARD_LINE_BREAKS | IFILTER_INIT.FILTER_OWNED_VALUE_OK; if (filter.Filter.Init(iflags, 0, IntPtr.Zero, out flags) == IFilterReturnCode.S_OK) { return(filter); } } using (filter) return(null); }
public FilterReader(string fileName) { m_Filter = FilterLoader.LoadAndInitIFilter(fileName); if (m_Filter == null) { throw new ArgumentException(string.Format("no filter defined for {0}", fileName)); } }