Esempio n. 1
0
 private void OnDirectoryPolled(HashEventArgs e)
 {
     if (DirectoryPolled != null)
     {
         DirectoryPolled(this, e);
     }
 }
Esempio n. 2
0
 /// <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.");
     }
 }
Esempio n. 3
0
 private void OnSearchCompleted(HashEventArgs e)
 {
     if (SearchCompleted != null)
     {
         SearchCompleted(this, e);
     }
 }
Esempio n. 4
0
 /// <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);
     }
 }
Esempio n. 5
0
 private void OnTaskCompleted(HashEventArgs e)
 {
     if (TaskCompleted != null)
     {
         TaskCompleted(this, e);
     }
 }
Esempio n. 6
0
 private void OnFilePolled(HashEventArgs e)
 {
     if (FilePolled != null)
     {
         FilePolled(this, e);
     }
 }
Esempio n. 7
0
 /// <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");
     //}
 }
Esempio n. 8
0
 /// <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;
     }
 }
Esempio n. 9
0
 /// <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;
 }
Esempio n. 10
0
 /// <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));
     }
 }
Esempio n. 11
0
 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);
     }
 }
Esempio n. 12
0
 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;
     }
 }
Esempio n. 13
0
 /// <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);
             }
         }
     }
 }
Esempio n. 14
0
 /// <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);
         }
     }
 }
Esempio n. 15
0
 /// <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);
     }
 }
Esempio n. 16
0
 private void SearchCompleted(object o, HashEventArgs e)
 {
     //THREAD_COUNT--;
     //THREAD_INDEX = e.TaskID;
     //Console.WriteLine("i finished a search");
 }
Esempio n. 17
0
 /// <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);
 }