wiki:AttributeUsage

The CrypTool Attributes

CrypTool has specific attributes to support the plugin developer with GUI development. Some are optional, some essential and some attributes are only used for editor plugins:


AuthorAttribute

Please do not enter dummy URLs or a faked email address. Skip this attribute completely or enter 'null' value in fields you don't want to give information.

Useability: Optional

Parameters:

  1. string author: the author's name
  2. string email: the author's e-mail address
  3. string institute: the author's institute
  4. string url: an url to the author's web site

Example:

[Author("Name Surname", "name.surname", "Institute", "URL")]

ComponentCategoryAttribute

Used to set the category for the plugin.

Useability: Essential

Parameters:

  1. ComponentCategory category: set the plugin's category

Example:

[ComponentCategory(ComponentCategory.ToolsMisc)]

ContextMenuAttribute

Do not use this attribute anymore.

Useability: Obsolete


DontSaveAttribute

Used as flag to mark a plugin's property so that it would not be saved in the workspace file.

Useability: Optional

Parameters: none

Example:

[TaskPane( ... )]
[DontSave]
public int OpenCLDevice
{ ... }

EditorInfoAttribute

This attribute should be only used by editor plugins, like for example the workspace manager.

Used to provide information about the editor's abilities.

Useability: Insignificant

Parameters:

  1. string defaultExtension: represents the editor's default file extension
  2. bool showAsNewButton: adds the editor to the "new"-button; default: true
  3. bool showLogPanel: show the log panel; default: true
  4. bool showSettingsPanel: show the settings panel; default: false
  5. bool showComponentPanel: show the component panel; default: true
  6. bool singleton: only one editor instance is allowed, if true; default: false
  7. bool canEdit: activates the buttons "Add Image" and "Add Text" at the category "Edit" of the ribbon bar; default: false

Example:

[TabColor("LightSlateGray")]
[EditorInfo("cwm", true, true, false, true, false, true)]
[Author( ... )]
[PluginInfo( ... )]
public class WorkspaceManagerClass : IEditor
{ ... }

LocalizationAttribute

Used to provide the localization ressource class for XAML with localized strings for internationalization using the mechanism described here. This should not be confused with the ressource property of the PluginInfoAttribute.

Useability: Optional

Parameters:

  1. string resourceClassPath: the path to the resource class (i.e. namespace.classname)

Example:

[Localization("Cryptool.Plugins.MD5.Properties.Resources")]
public partial class AddedLengthPresentation : UserControl
{ ... }

PluginInfoAttribute

Used to describe different plugin properties. If not provided your plugin can't be used in CrypTool!

Useability: Essential

Parameters:

  1. string resourceFile: the resource file - optional
  2. string caption: general name of the method
  3. string toolTip: the tooltip's text
  4. string descriptionUrl: URI to description, if provided
  5. params string[] icons: URIs to the plugin's icons

Example:

[PluginInfo("Cryptool.Caesar.Properties.Resources", "Caesar", "Classic alphabet shift substitution cipher", "Caesar/DetailedDescription/doc.xml",
        new[] { "Caesar/Images/Caesar.png", "Caesar/Images/encrypt.png", "Caesar/Images/decrypt.png" } )]

PropertyInfoAttribute

Used to declare a plugin's properties as a connector and describe it's metainformations.

Useability: Essential

Parameters:

  • mandatory
    1. Direction direction: direction of the data
    2. string caption: the property's name
    3. string toolTip: description of the property
  • optional
    • bool mandatory: property is mandatory if set to true

Example:

[PropertyInfo(Direction.InputData, "Text input", "Input a string to be processed by the Caesar cipher", true)]

PropertySaveOrderAttribute

Do not use this attribute anymore.

Useability: Obsolete


RibbonBarAttribute

Do not use this attribute anymore.

Useability: Obsolete


SettingsFormatAttribute

Used to format a plugin's setting property.

Useability: Optional

Parameters:

  • mandatory
    1. int indent: moves the property caption to the choosen indent
    2. string fontWeight: set the font weight
    3. string fontStyle: set the font style

  • optional
    • string foreGroundColor: set the foreground color
    • string backGroundColor: set the background color
    • Orientation orientation: set the orientation
    • string widthCol1: Column width of column one. Is only used when no group is selected. Value samples: Auto, Auto or 1*, 2*. Last sample indicates that column 1 wants to be given twice as much of the available space as the row marked with 1*.
    • string widthCol2: Column width of column two. Is only used when no group is selected.
    • string verticalGroup: group some properties

Example:

[SettingsFormat(1, "Normal", "Normal")]
[TaskPane( ... )]
public bool AnalysisUseRotorI
{ ... }

[SettingsFormat(0, "Normal", "Normal", "Black", "White", Orientation.Horizontal, "Auto", "*", "Acht")]
[TaskPane( ... )]
public int PlugBoardV
{ ... }

SettingsTabAttribute

Used to mark a class that offers a setting tab.

Useability: Insignificant

Parameters:

  1. string caption: the settings' tabs name
  2. string address: the position in the settings tree
  3. double priority: A double that represents the settings tab priority. Tabs with higher priority will be shown first. default: 0.5

Example:

[SettingsTab("KeySearcher", "/PluginSettings/")]
public partial class KeysearcherSettingsTab : UserControl
{ ... }

TabColorAttribute

Used to set the brush color for drawing the tabs background.

Useability: Insignificant

Parameters:

  1. string brush: the brush color

Example:

[TabColor("LightSlateGray")]
[EditorInfo("cwm", true, true, false, true, false, true)]
[Author( ... )]
[PluginInfo( ... )]
public class WorkspaceManagerClass : IEditor
{ ... }

TaskPaneAttribute

Used to declare a plugin's property (in it's settings class) as a setting item.

Useability: Essential

Parameters:

  • mandatory
    1. string caption: parameter's name
    2. string toolTip: parameter's tooltip
    3. string groupName: parameter's group
    4. int order: A number to change the order of the parameters in the same group. Parameters with a lower number are displayed first. Parameters with same number are alphabetically arranged.
    5. bool changeableWhileExecuting: parameter is during the execution changable, if set to true
    6. ControlType controlType: parameter's control type

  • optional
    • params string[] controlValues: control values used to display in ComboBox
    • ValidationType validationType: possibility to validate the input's type
    • int integerMinValue: minimum value for instance for ControlType.NumericUpDown
    • int integerMaxValue: maximum value for instance for ControlType.NumericUpDown
    • double doubleMinValue: minimum value
    • double doubleMaxValue: maximum value
    • string regularExpression: regex validation for ControlType.TextBox

Example:

[TaskPane( "Max. plugs searched", "Select how many plugs should ...", "Analysis options", 9, false, ControlType.NumericUpDown, ValidationType.RangeInteger, 1, 26)]
public int MaxSearchedPlugs
{ ... }

[TaskPane("Plug search method", "Which method should be ...", "Analysis options", 9, false, ControlType.ComboBox, new string[] { "Index of coincidence", "log2-bigram", "log2-trigram" })]
public int PlugSearchMethod
{ ... }         
                
[TaskPane( "Key (Initial rotor setting)", "Please provide the initial rotor setting ...", null, 1, false, ControlType.TextBox, ValidationType.RegEx, "^[A-Za-z]{3,4}$")]
public string Key
{ ... }
                
[TaskPane( "Presentation Speed", "Change the pace of the presentation", "Presentation", 71, true, ControlType.Slider, 2, 25)]
public int PresentationSpeed
{ ... }

All supported attributes can be found in the project browser of your IDE at "CrypPluginBase/Attributes/xxx.cs".

Last modified 7 years ago Last modified on Apr 20, 2012, 3:33:39 PM