|
In Magic Codes, all plugins are simple (and generally tiny)
Java classes that implement the
org.ninjasoft.magiccodes.plugins.Plugin interface. Upon launch,
Magic Codes looks through its classpath to discover plugins.
Any Java class that conforms to the interface is automatically
discovered and available to the user. There are only five
methods defined in the Plugin interface, and all but one are
used by Magic Codes to determine the nature of the plugin.
The methods are as follows:
Name
|
Description
|
getName()
|
The "short name" of the plugin. Used for populating
the dropdown list.
|
getDescription()
|
The "long name" of the plugin. This should be a concise
sentence describing the plugin. This appears in the Magic
Codes window just below the dropdown.
|
usesKey()
|
Does this plugin require a key? Some plugins do not
(for instance, any informational plugin or the MD5 plugin).
This is simply used by the Magic Codes window to determine
whether or not to enable the key entry text field.
|
isInformational()
|
Is the plugin informational? If the plugin simply
returns informational text, there is no need to display
it as hex or binary. This is used to override the output
format, in case the user accidentally has it set to a
non ASCII-text value.
|
doAction()
|
This takes an arry of input bytes, an array of key
bytes (which may be a zero-length array if no key was
set by the user). The plugin should perform whatever
processing it needs to do, then return an array of
output bytes. Note that even though the input and output
are integer arrays, they contain byte data. This is
because Java has no concept of "unsigned char" or "unsigned
byte" datatypes. In many cases, it is much easier to work
with integers than it is to constantly do
"(input[i
]
+ 256) % 256".
|
For further details, please
see
the Javadoc page for the Plugin interface
.
|