| Initializing the File Type Manager |
This section contains information about how applications hosting the file type support framework can handle initialization of the File Type Manager.
The IFileTypeManager is the main integration point between an application and the file type support framework. The file type manager is typically initialized so that it knows about all file type installed on the system. This section discussed different approaches to that initialization.
The SDL File Type Support Framework is used in an application through the File Type Manager.
There are different ways for an application to host the File Type Manager. The most straightforward way is to simply create and initialize it expicitly with a list of File Type Component Builders and related settings. Note: You need a reference to Sdl.FileTypeSupport.Framework.Core.Utilities in your project. The example below shows how to do this:
IFileTypeManager filterManager = DefaultFileTypeManager.CreateInstance(); filterManager.AddFileTypeDefinition(new SimpleTextFilterComponentBuilder()); filterManager.AddFileTypeDefinition(new SdlXliffFilterComponentBuilder()); // ...additional filter manager initialization goes here... UseFilterManagerForSomething(filterManager);
The example defines in the first line a PocoFilterManager (an implementation of IFileTypeManager) that provides functionality to add new filter definitions. It relies on the IFileTypeComponentBuilder to build File Type Definitions. In the second line an Open Office Text filter definition is adding using the OdtFilterDefinitionComponentBuilder (See the filter component builder example) This approach is very straightforward, but it has several implications that are worth noting: