예제 #1
0
        public List <TXFileInfo> GetRecentFilesAndFolders(IEnumerable <string> extraFiles, IEnumerable <string> extraFolders)
        {
            using (Log.DebugCall())
            {
                try
                {
                    string[]          recentFileNames   = null;
                    string[]          recentFolderNames = null;
                    FileFolderChecker checker           = new FileFolderChecker();

                    // Read both files under the mutex, then process the contents.

                    RecentlyCreated.GetFilesAndFolders(Log, out recentFileNames, out recentFolderNames);

                    if (recentFileNames != null)
                    {
                        checker.CheckFiles(recentFileNames, fromRecentFiles: true);
                    }

                    if (recentFolderNames != null)
                    {
                        checker.CheckFolders(recentFolderNames, fromRecentFiles: true);
                    }

                    // The "extra" files and folders are paths that might or might not be
                    // the recent files/folders lists, but the client wants us to check on.
                    // Typically they are from the Viewer's "recently viewed" lists.

                    if (extraFiles != null)
                    {
                        checker.CheckFiles(extraFiles, fromRecentFiles: false);
                    }

                    if (extraFolders != null)
                    {
                        checker.CheckFolders(extraFolders, fromRecentFiles: false);
                    }

                    Log.Debug("Returning ", checker.CombinedResult.Count, " items.");
                    return(checker.CombinedResult);
                }
                catch (Exception ex)
                {
                    Log.Error("Exception in GetRecentFilesAndFolders(): ", ex);
                    throw;
                    //throw new FaultException<ExceptionDetail>(new ExceptionDetail(ex), "Exception in GetRecentFilesAndFolders() (on the server).");
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Opens the log file using the current values of various properties.  Raises the Opening and Opened events.
        /// </summary>
        public override bool Open()
        {
            bool result = base.Open();

            if (result)
            {
                if (AddToListOfRecentlyCreatedFiles)
                {
                    // Update the list of recently created files in a worker thread, but don't use a
                    // ThreadPool thread because they are background threads, and some apps
                    // terminate so quickly that a background thread won't finish before being
                    // killed.

                    Thread thread = new Thread(() => RecentlyCreated.AddToRecentlyCreated(FullPath));
                    thread.IsBackground = false;
                    thread.Start();
                }
            }

            return(result);
        }