Exemplo n.º 1
0
        /// <summary>
        /// Start a search routine.
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="type"></param>
        public void BeginSearch(string keyword, WildCardType type)
        {
            mode = HashMode.Search;
            bool isactive        = false;
            WildCardCollection w = new WildCardCollection(type, keyword);

            if (priorityRnr != null && priorityPoller != null)
            {
                isactive = priorityPoller.IsActive(w);
                if (priorityRnr.IsBusy && !isactive)
                {
                    priorityRnr.CancelAsync();
                }
            }
            if (!isactive)
            {
                this.priorityPoller = new TaskPoller(w, brain.Rules.GetRule(w), logger);
                this.priorityPoller.HashItemFound         += new HashItemFoundHandler(OnPriorityItemFound);
                this.priorityPoller.HashCompleted         += new HashCompletedHandler(OnHashCompleted);
                this.priorityPoller.IgnoreDepthRestriction = true;
                this.priorityRnr.RunWorkerAsync();
                this.hashTimer.BeginTimer();
            }
        }