Changeset 1507


Ignore:
Timestamp:
May 26, 2010, 7:54:12 PM (12 years ago)
Author:
Matthäus Wander
Message:

Updated plugin template. The template shall become the default way to create a new CT2 plugin.

Location:
trunk
Files:
5 added
1 deleted
4 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/CrypPluginTemplate/ExamplePluginCT2.cs

    r740 r1507  
    1 /*
    2    Copyright 2009 Matthäus Wander, Universität Duisburg-Essen
     1/* HOWTO: Change year, author name and organization.
     2   Copyright 2010 Your Name, University of Duckburg
    33
    44   Licensed under the Apache License, Version 2.0 (the "License");
     
    2424using System.Windows.Controls;
    2525
    26 namespace Cryptool.Plugin.ExamplePluginCT2
     26namespace Cryptool.Plugin
    2727{
     28    // HOWTO: Change author name, email address, organization and URL.
    2829    [Author("Matthäus Wander", "wander@cryptool.org", "Universität Duisburg-Essen, Fachgebiet Verteilte Systeme", "http://www.vs.uni-due.de")]
     30    // HOWTO: Change plugin caption (title to appear in CT2) and tooltip. You can (and should) provide a description XAML and an own icon as well.
    2931    [PluginInfo(false, "Example Plugin", "Subtract one number from another", null, "CrypWin/images/default.png")]
     32    // HOWTO: Change interface to one that fits to your plugin (see CrypPluginBase).
    3033    public class ExamplePluginCT2 : IIOMisc
    3134    {
    3235        #region Private Variables
    3336
    34         private ExamplePluginCT2Settings settings = new ExamplePluginCT2Settings();
     37        // HOWTO: You need to adapt the settings class as well, see the corresponding file.
     38        private readonly ExamplePluginCT2Settings settings = new ExamplePluginCT2Settings();
    3539
    3640        #endregion
     
    3943
    4044        /// <summary>
    41         /// Input interface to read the input data.
     45        /// HOWTO: Input interface to read the input data.
    4246        /// You can add more input properties of other type if needed.
    4347        /// </summary>
     
    5054
    5155        /// <summary>
    52         /// Output interface to write the output data.
     56        /// HOWTO: Output interface to write the output data.
    5357        /// You can add more output properties ot other type if needed.
    5458        /// </summary>
     
    7074
    7175        /// <summary>
    72         /// Optional: provide custom (tabbed) presentation to visualize your algorithm
     76        /// HOWTO: You can provide a custom (tabbed) presentation to visualize your algorithm.
     77        /// Return null if you don't provide one.
    7378        /// </summary>
    7479        public UserControl Presentation
     
    7883
    7984        /// <summary>
    80         /// Optional: provide custom (quickwatch) presentation to visualize your algorithm
     85        /// HOWTO: You can provide custom (quickwatch) presentation to visualize your algorithm.
     86        /// Return null if you don't provide one.
    8187        /// </summary>
    8288        public UserControl QuickWatchPresentation
     
    9096
    9197        /// <summary>
    92         /// The algorithm you'd like to implement
     98        /// HOWTO: Enter the algorithm you'd like to implement in this method.
    9399        /// </summary>
    94100        public void Execute()
    95101        {
     102            // HOWTO: Use this to show the progress of a plugin algorithm execution in the editor.
    96103            ProgressChanged(0, 1);
    97104
     105            // HOWTO: After you have changed an output property, make sure you announce the name of the changed property to the CT2 core.
    98106            Difference = Minuend - settings.Subtrahend;
    99107            OnPropertyChanged("Difference");
    100108
     109            // HOWTO: You can pass error, warning, info or debug messages to the CT2 main window.
    101110            if (settings.Subtrahend < 0)
    102111                GuiLogMessage("Subtrahend is negative", NotificationLevel.Debug);
    103112
     113            // HOWTO: Make sure the progress bar is at maximum when your Execute() finished successfully.
    104114            ProgressChanged(1, 1);
    105115        }
  • trunk/CrypPlugins/CrypPluginTemplate/ExamplePluginCT2Settings.cs

    r740 r1507  
    1 /*
    2    Copyright 2009 Matthäus Wander, Universität Duisburg-Essen
     1/* HOWTO: Change year, author name and organization.
     2   Copyright 2010 Your Name, University of Duckburg
    33
    44   Licensed under the Apache License, Version 2.0 (the "License");
     
    2121using System.ComponentModel;
    2222
    23 namespace Cryptool.Plugin.ExamplePluginCT2
     23namespace Cryptool.Plugin
    2424{
    2525    public class ExamplePluginCT2Settings : ISettings
     
    3434        #region TaskPane Settings
    3535
    36         #region ISettings Members
    37 
     36        /// <summary>
     37        /// HOWTO: This is an example for a setting entity shown in the settings pane on the right of the CT2 main window.
     38        /// This example setting uses a number field input, but there are many more input types available, see ControlType enumeration.
     39        /// </summary>
    3840        [TaskPane("Subtrahend", "Amount to subtract from input number", null, 1, false, DisplayLevel.Beginner, ControlType.NumericUpDown, ValidationType.RangeInteger, 0, Int32.MaxValue)]
    3941        public int Subtrahend
     
    4547            set
    4648            {
     49                // HOWTO: If a setting changes, you must set hasChanges manually to true.
    4750                if (subtrahend != value)
    4851                {
     
    5558        #endregion
    5659
     60        #region ISettings Members
     61
    5762        /// <summary>
    58         /// need to store the change status of the plugin
    59         /// if a property was changed -> hasChangess = true
    60         /// hence CrypTool will ask automatically if you want to save your changes
     63        /// HOWTO: This flags indicates whether some setting has been changed since the last save.
     64        /// If a property was changed, this becomes true, hence CrypTool will ask automatically if you want to save your changes.
    6165        /// </summary>
    6266        public bool HasChanges
  • trunk/CrypPlugins/CrypPluginTemplate/Properties/AssemblyInfo.cs

    r740 r1507  
    66// set of attributes. Change these attribute values to modify the information
    77// associated with an assembly.
    8 [assembly: AssemblyTitle("ExamplePluginCT2")]
     8[assembly: AssemblyTitle("CrypPluginTemplate")]
    99[assembly: AssemblyDescription("")]
    1010[assembly: AssemblyConfiguration("")]
    1111[assembly: AssemblyCompany("")]
    12 [assembly: AssemblyProduct("ExamplePluginCT2")]
    13 [assembly: AssemblyCopyright("Copyright ©  2009")]
     12[assembly: AssemblyProduct("CrypPluginTemplate")]
     13[assembly: AssemblyCopyright("Copyright © 2010")]
    1414[assembly: AssemblyTrademark("")]
    1515[assembly: AssemblyCulture("")]
  • trunk/CrypTool 2.0.sln

    r1501 r1507  
    159159Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CostFunction", "CrypPlugins\CostFunction\CostFunction.csproj", "{3C72FF93-48C2-4929-B3B2-83F165AAE636}"
    160160EndProject
    161 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamplePluginCT2", "CrypPlugins\ExamplePluginCT2\ExamplePluginCT2.csproj", "{B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}"
    162 EndProject
    163161Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HMAC", "CrypPlugins\HMAC\HMAC.csproj", "{9DC8FE92-6839-4837-8AAA-D7456F2B288F}"
    164162EndProject
     
    222220EndProject
    223221Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "P2PEditor", "CrypPlugins\P2PEditor\P2PEditor.csproj", "{59DEB752-BEB6-4B2B-86A9-78B150537529}"
     222EndProject
     223Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrypPluginTemplate", "CrypPlugins\CrypPluginTemplate\CrypPluginTemplate.csproj", "{B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}"
    224224EndProject
    225225Global
     
    839839                {3C72FF93-48C2-4929-B3B2-83F165AAE636}.Release|x86.ActiveCfg = Release|x86
    840840                {3C72FF93-48C2-4929-B3B2-83F165AAE636}.Release|x86.Build.0 = Release|x86
    841                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x64.ActiveCfg = Debug|x64
    842                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x64.Build.0 = Debug|x64
    843                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x86.ActiveCfg = Debug|x86
    844                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x86.Build.0 = Debug|x86
    845                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x64.ActiveCfg = Release|x64
    846                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x64.Build.0 = Release|x64
    847                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x86.ActiveCfg = Release|x86
    848                 {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x86.Build.0 = Release|x86
    849841                {9DC8FE92-6839-4837-8AAA-D7456F2B288F}.Debug|x64.ActiveCfg = Debug|x64
    850842                {9DC8FE92-6839-4837-8AAA-D7456F2B288F}.Debug|x64.Build.0 = Debug|x64
     
    10871079                {59DEB752-BEB6-4B2B-86A9-78B150537529}.Release|x86.ActiveCfg = Release|x86
    10881080                {59DEB752-BEB6-4B2B-86A9-78B150537529}.Release|x86.Build.0 = Release|x86
     1081                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x64.ActiveCfg = Debug|x64
     1082                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x64.Build.0 = Debug|x64
     1083                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x86.ActiveCfg = Debug|x86
     1084                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Debug|x86.Build.0 = Debug|x86
     1085                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x64.ActiveCfg = Release|x64
     1086                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x64.Build.0 = Release|x64
     1087                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x86.ActiveCfg = Release|x86
     1088                {B300C1F7-42CB-4668-9CCB-319D6AF8E3EB}.Release|x86.Build.0 = Release|x86
    10891089        EndGlobalSection
    10901090        GlobalSection(SolutionProperties) = preSolution
  • trunk/Documentation/Template/CrypTool 2.0 Plugin.txt

    r1495 r1507  
    1 Place the zip file into the following directory: My Documents\Visual Studio 20008\Templates\Project Templates\
    2 Then you can select ExamplePluginCT2 as template when creating a new C# project.
     1Place the zip file into the following directory: Documents\Visual Studio 2010\Templates\Project Templates\
     2Do not unpack the zip file.
    33
    4 You should select trunk\CrypPlugins\ as location and do not create a directory for solution.
    5 If you select a different location, you will have to fix the reference to CrypPluginBase.
     4Then, you can add a new C# project to the CT2 solution and select CrypTool 2.0 Plugin as template.
     5
     6You must select trunk\CrypPlugins\ as location or the plugin will be built into the wrong directory.
Note: See TracChangeset for help on using the changeset viewer.