Changeset 962


Ignore:
Timestamp:
Dec 7, 2009, 7:48:37 PM (12 years ago)
Author:
Matthäus Wander
Message:

AnotherEditor:

  • does not show a warning anymore when a missing property in save file is marked with the DontSave attribute

CrypWin:

  • changed AssemblyCompany to "CrypTool2" as this string is being used to determine AppData directory (where the user.config file is located)
  • added support for arbitrary enums as TaskPane settings (see WordPatterns how to use them)

Dictionary:

  • fixed some bugs in Dictionary file handling

WordPatterns:

  • added XAML description
  • added case sensitivity setting (enum!)
  • minor sample fix

Note: New binaries are not included as I have some more unfinished core changes on my machine.

Location:
trunk
Files:
1 added
6 edited

Legend:

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

    r520 r962  
    248248            get
    249249            {
    250                 if (dicList != null && dicList.Length > settings.Dictionary)
     250                if (dicList != null && settings.Dictionary >= 0 && settings.Dictionary < dicList.Length)
    251251                    return dicList[settings.Dictionary];
    252252                else
     
    331331        public void Execute()
    332332        {
     333            if (CurrentDicSelection == null)
     334            {
     335                GuiLogMessage("No dictionary chosen.", NotificationLevel.Error);
     336                return;
     337            }
     338
    333339            EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(50, 100));
    334340            EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs("OutputList"));
     
    428434            dicList = dataMgr.LoadDirectory(DATATYPE).Values.ToArray();
    429435
    430             settings.Collection.Clear();
     436            if (settings.Collection.Count > 0)
     437                settings.Collection.Clear();
     438
    431439            foreach (DataFileMetaInfo meta in dicList)
    432440            {
  • trunk/CrypPlugins/Dictionary/DictionarySettings.cs

    r520 r962  
    244244
    245245    // CrypWin requires this to be a collection of strings
     246    [DontSave]
    246247    public ObservableCollection<string> Collection
    247248    {
  • trunk/CrypPlugins/WordPatterns/WordPatterns.cs

    r893 r962  
    2323     */
    2424    [Author("Matthäus Wander", "wander@cryptool.org", "Fachgebiet Verteilte Systeme, Universität Duisburg-Essen", "http://www.vs.uni-due.de")]
    25     [PluginInfo(false, "WordPatterns", "Searches for words with the same pattern", null, "CrypWin/images/default.png")]
     25    [PluginInfo(false, "WordPatterns", "Searches for words with the same pattern", "WordPatterns/WordPatternsDescription.xaml", "CrypWin/images/default.png")]
    2626    public class WordPatterns : IAnalysisMisc
    2727    {
    2828        #region Private stuff
    2929
    30             private WordPatternsSettings settings = new WordPatternsSettings();
    31 
    32             private string inputText;
    33             private string[] inputDict;
    34             private string outputText;
    35 
    36             private IDictionary<Pattern, IList<string>> dictPatterns;
    37 
    38             private bool stop = false;
     30        private WordPatternsSettings settings = new WordPatternsSettings();
     31
     32        private string inputText;
     33        private string[] inputDict;
     34        private string outputText;
     35
     36        private IDictionary<Pattern, IList<string>> dictPatterns;
     37       
     38        private bool stop = false;
    3939
    4040        #endregion
     
    8282        }
    8383
     84        public bool CaseSensitive
     85        {
     86            get
     87            {
     88                return settings.CaseSelection == Case.Sensitive;
     89            }
     90        }
     91
    8492        #endregion
    8593
     
    130138
    131139            // calculate input word pattern
    132             Pattern inputPattern = new Pattern(inputText);
     140            Pattern inputPattern = new Pattern(inputText, CaseSensitive);
    133141
    134142            if (inputDict == null)
     
    144152                {
    145153                    string word = inputDict[wordCount];
    146                     Pattern p = new Pattern(word);
     154                    Pattern p = new Pattern(word, CaseSensitive);
    147155
    148156                    // two calls to Pattern.GetHashCode()
     
    188196            private readonly int hashCode;
    189197
    190             internal Pattern(string word)
    191             {
     198            internal Pattern(string word, bool caseSensitive)
     199            {
     200                if (!caseSensitive)
     201                    word = word.ToLower();
     202
    192203                patternArray = new int[word.Length];
    193204                hashCode = -2128831035; // int32 counterpart of uint32 2166136261
  • trunk/CrypPlugins/WordPatterns/WordPatterns.csproj

    r740 r962  
    8181    </None>
    8282  </ItemGroup>
     83  <ItemGroup>
     84    <Resource Include="WordPatternsDescription.xaml">
     85      <Generator>MSBuild:Compile</Generator>
     86      <SubType>Designer</SubType>
     87    </Resource>
     88  </ItemGroup>
    8389  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    8490  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • trunk/CrypPlugins/WordPatterns/WordPatternsSettings.cs

    r435 r962  
    44using System.Text;
    55using Cryptool.PluginBase;
     6using System.ComponentModel;
     7using System.Windows.Data;
    68
    79namespace WordPatterns
    810{
     11    enum Case
     12    {
     13        Sensitive,
     14        Insensitive
     15    }
     16
    917    class WordPatternsSettings : ISettings
    1018    {
    1119        private bool hasChanges = false;
     20
     21        private Case caseSelection = Case.Insensitive;
     22
     23        [TaskPane("Case sensitivity", "Choose whether uppercase/lowercase should be treated as different (case sensitive) or equal (case insensitive)", "", 1, false, DisplayLevel.Expert, ControlType.ComboBox)]
     24        public Case CaseSelection
     25        {
     26            get { return caseSelection; }
     27            set
     28            {
     29                if (caseSelection != value)
     30                {
     31                    caseSelection = value;
     32                    hasChanges = true;
     33                    OnPropertyChanged("CaseSelection");
     34                }
     35            }
     36        }
     37
     38        private void OnPropertyChanged(string p)
     39        {
     40            if (PropertyChanged != null)
     41            {
     42                PropertyChanged(this, new PropertyChangedEventArgs(p));
     43            }
     44        }
    1245
    1346        #region ISettings Members
Note: See TracChangeset for help on using the changeset viewer.