Changeset 556


Ignore:
Timestamp:
Sep 22, 2009, 11:48:05 AM (12 years ago)
Author:
Arno Wacker
Message:

Scytale: Added some error checking and a new icon
Note: Calculation of CharsPerRow is suspicious - further analysis required to determine if correct (line 88 in Scytale.cs)

Location:
trunk/CrypPlugins/Scytale
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/Scytale/Scytale.cs

    r552 r556  
    33using Cryptool.PluginBase;
    44using Cryptool.PluginBase.Cryptography;
     5using Cryptool.PluginBase.Miscellaneous;
    56
    67namespace Cryptool.Scytale
     
    1617        public event PropertyChangedEventHandler PropertyChanged;
    1718        public event PluginProgressChangedEventHandler OnPluginProgressChanged;
     19        public event GuiLogNotificationEventHandler OnGuiLogNotificationOccured;
    1820#pragma warning disable 67
    1921        public event StatusChangedEventHandler OnPluginStatusChanged;
    20         public event GuiLogNotificationEventHandler OnGuiLogNotificationOccured;       
    2122#pragma warning restore
    2223
     
    7980            if (!string.IsNullOrEmpty(inputString))
    8081            {
     82                if (settings.StickSize < 1)
     83                {
     84                    EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs("Got an invalid stick size of " + settings.StickSize + "! Reverting to 1.", this, NotificationLevel.Warning));
     85                    settings.StickSize = 1;
     86                }
     87
    8188                CharsPerRow = inputString.Length / settings.StickSize + 1;
    8289                outputString = string.Empty;
     
    108115
    109116                //show the progress
    110                 if (OnPluginProgressChanged != null)
    111                 {
    112                     OnPluginProgressChanged(this, new PluginProgressEventArgs(i, inputString.Length - 2));
    113                 }
    114 
     117                EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(i, inputString.Length - 2));
    115118            }
    116119            outputString = outputString.Replace('_', ' ').Trim();
     
    135138
    136139                //show the progress
    137                 if (OnPluginProgressChanged != null)
    138                 {
    139                     OnPluginProgressChanged(this, new PluginProgressEventArgs(i, totalChars - 1));
    140                 }
     140                EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(i, totalChars - 1));
    141141            }
    142142        }
Note: See TracChangeset for help on using the changeset viewer.