public DistributedBruteForceManager(KeySearcher keySearcher, KeyPattern.KeyPattern keyPattern, KeySearcherSettings settings,
                                            KeyQualityHelper keyQualityHelper, P2PQuickWatchPresentation quickWatch, KeyPoolTreePresentation keyPoolTreePresentation)
        {
            this.keySearcher         = keySearcher;
            this.settings            = settings;
            this.keyQualityHelper    = keyQualityHelper;
            this.quickWatch          = quickWatch;
            _keyPoolTreePresentation = keyPoolTreePresentation;

            // TODO when setting is still default (21), it is only displayed as 21 - but the settings-instance contains 0 for that key!
            if (settings.ChunkSize == 0)
            {
                settings.ChunkSize = 21;
            }

            StopWatch = new Stopwatch();
            status    = new StatusContainer(keySearcher);
            status.IsCurrentProgressIndeterminate = true;

            keyGenerator        = new StorageKeyGenerator(keySearcher, settings);
            patternPool         = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, settings.ChunkSize)));
            StatisticsGenerator = new StatisticsGenerator(status, quickWatch, keySearcher, settings, this);
            quickWatch.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(UpdateStatusContainerInQuickWatch));

            _keyPoolTreePresentation.PatternPool      = patternPool;
            _keyPoolTreePresentation.KeyQualityHelper = keyQualityHelper;
            _keyPoolTreePresentation.KeyGenerator     = keyGenerator;
            _keyPoolTreePresentation.StatusContainer  = status;
        }
Пример #2
0
        public StatisticsGenerator(StatusContainer status, P2PQuickWatchPresentation quickWatch, KeySearcher keySearcher, KeySearcherSettings settings, DistributedBruteForceManager distributedBruteForceManager)
        {
            this.status      = status;
            this.quickWatch  = quickWatch;
            this.keySearcher = keySearcher;
            this.distributedBruteForceManager = distributedBruteForceManager;

            lastDateOfGlobalStatistics = DateTime.Now;
            HighestChunkCalculated     = -1;
            stopWatch = new Stopwatch();

            var keyPattern = new KeyPattern.KeyPattern(keySearcher.ControlMaster.GetKeyPattern())
            {
                WildcardKey = settings.Key
            };
            var keysPerChunk   = Math.Pow(2, settings.ChunkSize);
            var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(keysPerChunk));

            TotalAmountOfChunks = keyPatternPool.Length;

            status.PropertyChanged += StatusPropertyChanged;

            elapsedTimeTimer          = new Timer(1000);
            elapsedTimeTimer.Elapsed += ElapsedTimeTimerTick;
            elapsedTimeTimer.Start();

            trafficUpdateTimer          = new Timer(10000);
            trafficUpdateTimer.Elapsed += TrafficUpdateTimerTick;
            trafficUpdateTimer.Start();
        }