Ignore:
Timestamp:
Jun 15, 2010, 1:28:26 PM (11 years ago)
Author:
Paul Lelgemann
Message:

o Updated Peers@Play libraries
o Work on the distributed KeySearcher

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/KeySearcherSettings.cs

    r1634 r1643  
    22using System.Collections.Generic;
    33using System.Linq;
     4using System.Numerics;
    45using System.Text;
    56using Cryptool.PluginBase;
     
    2425
    2526            distributedJobIdentifier = Guid.NewGuid().ToString();
     27            chunkSize = 21;
    2628        }
    2729
     
    4143                    keysearcher.GuiLogMessage("Wrong key pattern!", NotificationLevel.Error);
    4244                HasChanges = true;
     45                OnPropertyChanged("TotalAmountOfChunks");
    4346            }
    4447        }
     
    117120
    118121        private int chunkSize;
    119         [TaskPane("Chunk size", "Amount of keys (x 10.000), that will be calculated by one peer at a time.", GroupPeerToPeer, 3, false, DisplayLevel.Professional,
    120             ControlType.NumericUpDown, ValidationType.RangeInteger, 250, int.MaxValue)]
     122        [TaskPane("Chunk size", "Amount of keys, that will be calculated by one peer at a time. This value is the exponent of the power of two used for the chunk size.", GroupPeerToPeer, 3, false, DisplayLevel.Professional,
     123            ControlType.NumericUpDown, ValidationType.RangeInteger, 1, 1000)]
    121124        public int ChunkSize
    122125        {
     
    128131                    chunkSize = value;
    129132                    OnPropertyChanged("ChunkSize");
    130                     HasChanges = true;
    131                 }
     133                    OnPropertyChanged("TotalAmountOfChunks");
     134                    HasChanges = true;
     135                }
     136            }
     137        }
     138
     139        [TaskPane("Amount of chunks", "Total number of chunks that must be calculated with the given chunk size.", GroupPeerToPeer, 4, false, DisplayLevel.Professional,
     140            ControlType.TextBox)]
     141        public double TotalAmountOfChunks
     142        {
     143            get {
     144                if (keysearcher.Pattern == null || !keysearcher.Pattern.testWildcardKey(key) || ChunkSize == 0)
     145                {
     146                    return 0;
     147                }
     148
     149                var keyPattern = new KeyPattern(keysearcher.ControlMaster.getKeyPattern());
     150                keyPattern.WildcardKey = key;
     151                var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, ChunkSize)));
     152                return (double) keyPatternPool.Length;
     153            }
     154            set
     155            {
     156                OnPropertyChanged("TotalAmountOfChunks");
    132157            }
    133158        }
Note: See TracChangeset for help on using the changeset viewer.