[This is preliminary documentation and is subject to change.]
Generates a plugin
Namespace: Tools.TotalCommanderT.PluginBuilderAssembly: TCPluginBuilder (in TCPluginBuilder.exe) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
public class Generator |
| Visual Basic |
|---|
Public Class Generator |
| Visual C++ |
|---|
public ref class Generator |
| F# |
|---|
type Generator = class end |
| JScript |
|---|
public class Generator |
Remarks
This class generates one or more Total Commander pluggin wrappers from given assembly/types.
Wrapper generation process can be invoked from command line or programatically using Generator API.
Separate wrapper is generated for each plugin class.
Wrapper generation consists of following steps:
- Prepare wrapper template - Template is copied to intermediate directory (either from specified template directory or from built-in template)
- Configure tamplate - Type wraper is being generated for is inspected to detect plugin type and which methods the plugin implements. Appropriate settings are generated to template files. Namely: Conditional compilation is set up to generate only those functions supported by plugin; Module export definition is written; Assembly info is generated.
- Invoke compiler - C++ compiler invoked via MSBuild to compile the wrapper. MSBuild and C++ compiler must be installled on your machine.
- Plugin class must be non-abstract, must have defualt (parameter-less) constructor and must notbe open generic type. When class that looks like plugin class is found, but does not meet these requirements it is ignored.
- Plugin class must derive from one of plugin types like FileSystemPlugin.
- Plugin class overrides its's base class methods to define plugin functionality. A few methods must be overriden. Majority of methods is optional.
- When non-compulsory method is overriden in derived class, wrapped generator examines it. When it is decorated with MethodNotSupportedAttribute it is NOT generated for the plugin; otherwise it is.
- Plugin class can, of course, define as many as you want additional methoda, but those methods are not part of plugin contract. When a new version of Total Commander is issued that defines more plugin API functions, those functions are not automatically supported by the generator. A new version of generator must be issued as well.
- When plugin class is decorated with NotAPluginAttribute, it is skipped from plugin generation.
- Optionaly plugin class can be decorated with TotalCommanderPluginAttribute to precise plugin generation.
- Plugin assembly is given correct plugin extension by plugin type.
- Plugin assembly inherits certain attributes from assembly plugin type is defined in or from plugin type istelf. Namely:
AssemblyVersionAttribute Got from assembly's AssemblyVersionAttribute (when defined); otherwise from Version. AssemblyTrademarkAttribute, AssemblyCopyrightAttribute, AssemblyProductAttribute, AssemblyCompanyAttribute, AssemblyConfigurationAttribute, NeutralResourcesLanguageAttribute, AssemblyFileVersionAttribute, AssemblyInformationalVersionAttribute Derived from assembly attributes (when set; ignored when not set) GuidAttribute Got from AssemblyGuid of plugin type (when set; ignored when not set) AssemblyTitleAttribute, AssemblyDescriptionAttribute Got from AssemblyTitle and AssemblyDescription of plugin type when set; otherwise got from appropriate assembly attributes when set; otherwise ignored. - When giving wrapper asembly a string name (using SnkPath) the assembly plugin is defined in must have string name as well.
- Wrapper name is specified by (in order of presedence): RenamingDictionary, Name, FullName.
To genereta plugin wraper for your plugin from Visual Stuidio environment as part of build process, simply add plugin generator tool TCPluginBuilder.exe as post-build event. Example post-build event:
Examples
This command line invokes TCPluginBuilder.exe and generates plugin(s) from output of project, places the w?x files into project output directory and uses project obj directory as its intermediate directory. Intermediate files are not deleted. Built-in template is used. w?x assembly is not signed.
CopyVB.NET
TCPluginBuilder.exe "$(TargetPath)" /out "$(TargetDir)\" /int "$(ProjectDir)obj\$(ConfigurationName)" /keepint
Deploying the plugin:
When Total Commander refuses to load your plugin try following troubleshoting tips:
- Place plugin files inside the same directory as TOTALCMD.EXE or one of subdirectories.
- Windows Vista: If you are ceating subdirectory inside Total Commander directory you will copy plugin for testing during development and you are changing rights on the directory in order to get rid of UAC, do not make yourself owner of the directory.
- Restart Total Commander in order to test a new version of your plugin.
Inheritance Hierarchy
See Also
Version History
1.5.3
- Property VCBuild removed. Class now use MSBuild which is referenced as assembly. Reference to VCBuild.exe removed from settings as well.
- Property SN removed. Class now use MSBuild task to sign resulting assembly. Reference to SN.exe removed from settings as well.