Ignore:
Timestamp:
Sep 16, 2009, 11:51:47 AM (12 years ago)
Author:
Matthäus Wander
Message:

AnotherEditor:

  • fixed bug in recent "QuickWatch of any Array" method
  • minor change for default QuickWatch

DataManager:

  • replaced Encoding (Cryptool.PluginBase.EncodingTypes) property with TextEncoding (System.Text.Encoding)

Dictionary:

  • enabled changing dict file during play mode (using PropertyChanged event and allowReexecution flag)
  • fixed recently introduced NullReferenceException
  • added support to above TextEncoding Property

MonoalphabeticAnalysis:

  • fixed erroneous file reference in .csproj

TextOutput:

  • fixed recently introduced NullReferenceException

WordPatterns:

  • added metainfo to german dictionary
  • improvements handling empty input and empty result set
Location:
trunk/CrypPlugins/Dictionary
Files:
2 edited

Legend:

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

    r511 r520  
    219219namespace Dictionary
    220220{
    221     [Author("Thomas Schmid", "thomas.schmid@cryptool.org", "Uni Siegen", "http://www.uni-siegen.de")]
     221    [Author("Thomas Schmid, Matthäus Wander", "thomas.schmid@cryptool.org", "Uni Siegen", "http://www.uni-siegen.de")]
    222222    [PluginInfo(true, "Dictionary", "Reads values from a Dictionary and returns all entries concatenated with given delimiter in one string.", null, "Dictionary/icon.png")]
    223223    public class CryptoolDictionary : IInput
     
    232232        private static Dictionary<DataFileMetaInfo, string[]> dicValues = new Dictionary<DataFileMetaInfo, string[]>();
    233233        private static Dictionary<DataFileMetaInfo, string> dicValuesOld = new Dictionary<DataFileMetaInfo, string>();
     234       
     235        // list of dictionaries
    234236        private static DataFileMetaInfo[] dicList;
    235237
     238        // Manages wordlist files
    236239        private DataManager dataMgr = new DataManager();
    237240
     241        // Flag to enable re-execution during play mode
     242        private bool allowReexecution = false;
     243
    238244        # endregion private_variables
    239245
     
    242248            get
    243249            {
    244                 if (dicList.Length > settings.Dictionary)
     250                if (dicList != null && dicList.Length > settings.Dictionary)
    245251                    return dicList[settings.Dictionary];
    246252                else
     
    329335            EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs("OutputString"));
    330336            EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(100, 100));
     337
     338            // enable re-execution after the first run
     339            allowReexecution = true;
    331340        }
    332341
    333342        public void PostExecution()
    334343        {
     344            // disable re-execution when leaving play mode
     345            allowReexecution = false;
    335346        }
    336347
     
    363374
    364375                    FileStream fs = file.DataFile.OpenRead();
    365                     StreamReader sr = new StreamReader(fs);
     376                    StreamReader sr;
     377                    if (file.TextEncoding == null)
     378                        sr = new StreamReader(fs);
     379                    else
     380                        sr = new StreamReader(fs, file.TextEncoding);
     381
    366382                    List<string> list = new List<string>();
    367383                    while (!sr.EndOfStream)
     
    394410        {
    395411            LoadFileList();
     412
     413            settings.PropertyChanged += SettingsPropertyChanged; // catch settings changes
     414        }
     415
     416        private void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e)
     417        {
     418            // if user chooses another dictionary, force re-execution
     419            if (allowReexecution && e.PropertyName == "Dictionary")
     420            {
     421                Execute();
     422            }
    396423        }
    397424
  • trunk/CrypPlugins/Dictionary/DictionarySettings.cs

    r511 r520  
    222222    # endregion private_variables
    223223
    224     [TaskPane("Dictionary", "Select dictionary with keywords.", "", 0, false, DisplayLevel.Beginner, ControlType.DynamicComboBox, new string[] { "Collection" })]
     224    public delegate void ExecuteCallback();
     225
     226    public CryptoolDictionarySettings()
     227    {
     228    }
     229
     230    [TaskPane("Dictionary", "Select dictionary with keywords.", "", 0, true, DisplayLevel.Beginner, ControlType.DynamicComboBox, new string[] { "Collection" })]
    225231    public int Dictionary
    226232    {
     
    275281    protected void OnPropertyChanged(string name)
    276282    {
    277       if (PropertyChanged != null)
    278       {
    279         PropertyChanged(this, new PropertyChangedEventArgs(name));
    280       }
     283        if (PropertyChanged != null)
     284        {
     285            PropertyChanged(this, new PropertyChangedEventArgs(name));
     286        }
    281287    }
    282288
Note: See TracChangeset for help on using the changeset viewer.