Creating your own Content-Engine
Developers who would like to create their customized Content-Engine, can find the source code of the ContentEngine.dll in the IceViewer HTML5 installation directory. By default, the directory is the following: C:\Program Files\Black Ice Software LLC\Black Ice IceViewer HTML5\ContentEngine\
The built-in IceViewer HTML5 Engines are written in C# Programming Language, and use .NET Framework 9. Developers will have to use the same programming language and framework for their implementation.
The Content-Engine Source Code contains an IContentEngine interface, which has to be implemented in the Engines Class, the same way as the FileEngine, WebEngine and DatabaseEngine. For the complete list of the IContentEngine methods, please refer to the IContentEngine Interface section.
Besides implementing the Interface, the Source Code requires two more modifications to hook up the new engine into IceViewer HTML5:
Add the new engine to the ContentEngineType enum in the Engines Class:
|
public enum ContentEngineType { Default, FileEngine, DatabaseEngine, WebEngine, MyCustomEngine // Your custom engine } |
Add the new engine to the CreateContentEngine method in the Engines Class:
|
public static Engine CreateContentEngine(ContentEngineType type = ContentEngineType.Default) { try { switch (type) { case ContentEngineType.DatabaseEngine: return new DatabaseEngine(); case ContentEngineType.WebEngine: Engine webEngine = new WebEngine(); (webEngine as WebEngine).LoadConfig(); return webEngine.GetInstance(); case ContentEngineType.MyCustomEngine: Engine e = new MyCustomEngine(); case ContentEngineType.FileEngine: default: Engine e = new FileEngine(); (e as FileEngine).LoadConfig(); return e.GetInstance(); } } catch (Exception) { throw; } } |
These modifications will ensure that IceViewer HTML5 know about this new engine, and will let users use it.
Once the implementation and modifications are done, you can compile the project.
Recommended approach to compile, and deploy the custom Content Engine DLL:
- Create a Publish profile in Visual Studio,
with the following settings:
- Target framework: NET9 – net9.0-windows7.0
- Deployment mode: Framework dependent
(IceViewer HTML5 folder already includes the framework)
- Target runtime: win-x64
- Replace the ContentEngine.dll in the <IceViewer HTML5 Website> directory, which is located below by default: C:\inetpub\wwwroot\iceviewer
- If your implementation requires additional DLL files (or you added nuget packages), also copy the additional DLL files to the IceViewer HTML website directory.
- Restart the IceViewer Application Pool in the IIS.
- Try starting up the IceViewer HTML5 in the browser, and see if you are able to open documents.
Framework/version requirements
The custom Content Engine DLL must be compiled against the same .NET runtime version as the IceViewer application. Mismatched frameworks (e.g., .NET Framework vs .NET Core/.NET 9) will cause the application to fail during startup. The IceViewer application is using .NET 9.
To open document using the new Engine, please refer to the Open Documents using URL parameters section.
