Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home
0 votes

Using the SDK's CSSampleNET4 program I can successfully build an app that will search through text files but I can't get it working for more complex file types, such as DOC and DOCX. How do I do that?

asked by (67.5k points)

1 Answer

0 votes

The first thing you need to do is make sure that the appropriate interpreters are switched on, e.g.

ExtensionPlugIn plugin = config.ExtensionPlugInList.Find("http://www.mythicsoft.com/doc");
plugin.Active = true;

Note: The URI for each plugin is listed in the XML file in the plugin_cfg subfolder of FileLocator Pro. The URI is defined in the child element <uniquename>.

That's all you need to do with some interpreters but other interpreters, including the DOC interpreter, use some helper .NET libraries located in the Mythicsoft.Conversion subfolder. The .NET runtime won't look in the subfolder unless you specifically tell it so you need to create/modify your EXE's configuration file.

A good starting point is the FileLocatorPro.exe.config file, which contains:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<startup useLegacyV2RuntimeActivationPolicy="true">
		<supportedRuntime version="v4.0"/>
		<supportedRuntime version="v2.0.50727"/>
	</startup>

	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<probing privatePath="Mythicsoft.Conversion"/>
		</assemblyBinding>
	</runtime>
</configuration>

Take a copy of that file and rename it to the name of your EXE, e.g. CSSampleNET4.exe.config, and make sure the privatePath points to the Mythicsoft.Conversion folder.

That should now allow your app to search and/or extract text from all the supported file types.


Using IFilters

If you don't want to use the Mythicsoft.Conversion based interpreters you can switch to using IFilters for those file types, e.g.

ExtensionPlugIn plugin = config.ExtensionPlugInList.Find("http://www.mythicsoft.com/doc");
plugin.Active = true;
plugin.UseIFilter = true;

Deep Search configuration

To switch all interpreters on there's a single flag that is the equivalent of Deep Search in FileLocator Pro:

config.AutoManageDocumentFormats = true;

Default configuration using an SRF file

A simple way to default the search configuration to a desired configuration is to create a search in FileLocator Pro, save it as an SRF file, then load it during the search criteria initialization:

using(System.IO.FileStream file = System.IO.File.Open("C:\\SavedSearch.srf", System.IO.FileMode.Open))
    criteria.Load(file);
answered by (67.5k points)
...