private void OnDirectoryPolled(HashEventArgs e) { if (DirectoryPolled != null) { DirectoryPolled(this, e); } }
/// <summary> /// Event: occurs when all directories request have /// been polled successfully and are awaiting hash or search. /// </summary> /// <param name="o">o</param> /// <param name="e">e</param> protected void OnPollCompleted(object o, HashEventArgs e) { if (logger != null) { logger.Info("I am done polling all folders."); } }
private void OnSearchCompleted(HashEventArgs e) { if (SearchCompleted != null) { SearchCompleted(this, e); } }
/// <summary> /// Event: Occurs when all folders have been added to the poll and are awaiting search. /// </summary> /// <param name="e"></param> public void OnHashPollCompleted(HashEventArgs e) { if (HashPollCompleted != null) { HashPollCompleted(new object(), e); } }
private void OnTaskCompleted(HashEventArgs e) { if (TaskCompleted != null) { TaskCompleted(this, e); } }
private void OnFilePolled(HashEventArgs e) { if (FilePolled != null) { FilePolled(this, e); } }
/// <summary> /// Event: Occurs when a single search within a directory is finished. /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void TaskCompleted(object o, HashEventArgs e) { //lock(this) //{ THREAD_COUNT--; THREAD_INDEX = e.TaskID; //Console.WriteLine("i finished a task"); //} }
/// <summary> /// EventHandler: occurs when an item following the search /// </summary> /// <param name="o"></param> /// <param name="e"></param> protected void OnItemFound(object o, HashEventArgs e) { //Console.WriteLine("Found: {0}", e.Task); lock (Cache) { Cache.Convert(e.Task); Cache.Status = poller.Status; } }
/// <summary> /// Event: occurs when an item is found using the priority poller. /// Of course...only Hasher cares about this...no other user should. /// </summary> /// <param name="o">o</param> /// <param name="e">e</param> protected void OnPriorityItemFound(object o, HashEventArgs e) { if (logger != null) { logger.Info(string.Format("Found: {0}", e.Task)); } lock (Cache) { Cache.Convert(e.Task); Cache.Status = priorityPoller.Status; } priorityWorking = true; }
/// <summary> /// EventHandler: occurs when all hash is completed. /// </summary> /// <param name="o">o</param> /// <param name="e">e</param> protected void OnHashCompleted(object o, HashEventArgs e) { Console.WriteLine("All folders completely hashed"); //Results.Convert(poller.Results); //MORE TIME CONSUMING! if (HashCompleted != null) { HashCompleted(this.Results, e); } if (logger != null) { logger.Info(string.Format("Hashing completed in {0} ms", hashTimer.TimeElapsed - StartTime)); } }
private void DirectorySeen(object sender, HashEventArgs e) { try { if (DirectoryFound != null) { DirectoryFound(new TaskItem(e.Task.ToLower(), e.TaskID), new HashEventArgs(e.Task, e.TaskID)); } } catch (System.Exception ex) { Console.WriteLine(ex); } }
private void FilePolled(object sender, HashEventArgs e) { if (!HALT) { foundCount++; if (FileAdded != null) { FileAdded(new object(), new HashEventArgs(e.Task)); } } if (this.FoundCount >= this.Limit) { HALT = true; } }
/// <summary> /// Event: Occurs when a file match is found for the given wildcard search /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void FileFound(object o, HashEventArgs e) { lock (Results) { //System.Console.WriteLine("{0}, was found as type requested", e.Task); if (!Results.Contains(e.Task)) { Results.Add(e.Task); if (HashItemFound != null) { HashItemFound(Results, e); } } } }
/// <summary> /// Event: Occurs when a directory is found while searching for the given wildcard. /// The directory is polled to be searched if necessary. /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void DirectoryFound(object o, HashEventArgs e) { lock (Poll) { //System.Console.WriteLine("{0}, was found and appended to queue", e.Task); if (!CompletedDirs.Contains(e.Task.ToLower()) && !Poll.Contains(e.Task.ToLower()) && !Exclude(e.Task)) { ManualResetEvent mre = new ManualResetEvent(false); tmpEvents.Add(mre); Task task = new Task((TaskItem)o, wildcards, SearchBrain.List.MaxPerFolder, mre); task.IsSubDir = true; Poll.Add(task); } } }
/// <summary> /// Sets the results when invoked. /// </summary> /// <param name="o"></param> /// <param name="e"></param> public static void SetResults(object o, HashEventArgs e) { /*lock(results){ * results = (ResultList)o; * wildcard = e.WildCards; * * }*/ if (wildcard != null) { Console.WriteLine("setting results! Size: {0} and wildcard: {1}", hasher.Results.Size, wildcard.Value); } else { Console.WriteLine("setting results! Size: {0} and wildcard: null", hasher.Results.Size); } }
private void SearchCompleted(object o, HashEventArgs e) { //THREAD_COUNT--; //THREAD_INDEX = e.TaskID; //Console.WriteLine("i finished a search"); }
/// <summary> /// When an item if found. /// </summary> /// <param name="foundItem"></param> /// <param name="e"></param> public static void OnItemFound(object foundItem, HashEventArgs e) { //lock(results){results = (ResultList)foundItem;} //Console.WriteLine("found something"); //System.Threading.Thread.Sleep(2000); }