Ejemplo n.º 1
0
 /// <summary>
 /// Handles updating the status of the search and cleans up the memory streams when the
 /// search finishes.
 /// </summary>
 private void mUiUpdateThrottle_Tick(object sender, EventArgs e)
 {
     // Flooding the UI will result in slower performance!
     if (mFileSearcher != null)
     {
         lock (mFileSearcher.Stats)
         {
             mResults.updateStatus(mFileSearcher.Stats);
             if (mFileSearcher.Stats.Finished)
             {
                 writeResultsToTextBox();
                 mUiUpdateThrottle.Enabled = false;
                 mStreamWriter.Dispose();
                 mStreamWriter.Close();
                 mMemoryStream.Dispose();
                 mMemoryStream.Close();
                 Settings.get().SearchParams.SearchInProgress = false;
                 DirectoryCache.get().update(DirectoryCache.UpdateType.Automatic, false);
                 mFileSearcher.HandleResults -= fileSearcher_HandleResults;
                 mFileSearcher = null;
                 GC.Collect();
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// The window was activated so we might need to check for a software update.
 /// </summary>
 private void Form1_Activated(object sender, EventArgs e)
 {
     if (mShouldCheckForUpdate)
     {
         Settings.get().Serialize();
         #if UPDATER_SUPPORTED
         Updater.Check();
         #endif
         mShouldCheckForUpdate = false;
     }
     GC.Collect();
     DirectoryCache.get().update(DirectoryCache.UpdateType.Automatic, false);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the single instance of the directory cache
 /// </summary>
 /// <returns>The single directory cache instance.</returns>
 public static DirectoryCache get()
 {
     if (sDirCache == null)
     {
         sInstanceMutex.WaitOne();
         if (sDirCache == null)
         {
             sDirCache = new DirectoryCache(Settings.get().SearchParams);
         }
         sInstanceMutex.ReleaseMutex();
     }
     return(sDirCache);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles commands from the debug window that the default logger doesn't know about.
        /// </summary>
        /// <param name="command">The command entered.</param>
        /// <returns>Output text to print to the debug window.</returns>
        public override string handleCommand(string command)
        {
            Regex           parser  = new Regex(@"[^\s""]+|""[^""]*""");
            MatchCollection matches = parser.Matches(command);

            String output;

            switch (matches[0].Value)
            {
            case "clearCache":
                DirectoryCache.get().update(DirectoryCache.UpdateType.Full, true);
                output = "Directory cache cleared.";
                break;

            case "track":
                if (matches.Count == 2)
                {
                    //Updater.WriteTrackFile(matches[1].Value);
                    output = "Track changed";
                }
                else
                {
                    output = "I don't know what you are trying to do.";
                }
                break;

            case "help_ext":
                output = "clearCache - clears the cached file list\r\ntrack name - sets the update track for this app";
                break;

            default:
                output = base.handleCommand(command);
                break;
            }
            return(output);
        }