Community Server registers all file viewers in the <FileViewers> region of the communityserver.config file. Each file viewer requires an <add /> node, which supports three attributes: type, extensions, and urlPattern.
The following image file viewer example shows all three supported attributes:
<add
type="CommunityServer.Components.ImageFileViewer, CommunityServer.Components"
extensions="gif;jpg;jpeg;bmp;png"
urlPattern="^[^\?]*?\.(?:gif|jpg|jpeg|bmp|png)(?:\?.*)?$"
/>
The type attribute identifies the class implementing the IFileViewer interface that should be registered. In the example above case, the interface is the CommunityServer.Components.ImageFileViewer class in the CommunityServer.Components assembly.
The extensions attribute identifies the semi-colon-separated list of file extensions that are supported by this viewer. These extensions are matched only to local files (those stored in the Centralized File System in Community Server 2008) and will not match to remote attachments or external URLs.
The urlPattern identifies a regular expression that matches URLs the file viewer can support. In the example above, the ImageFileViewer can render URLs that identify an image file extension.