Пример #1
0
        /// <summary>
        /// Initialise this instance with an implementation of ITraceClient
        /// </summary>
        /// <param name="client"></param>
        /// <exception cref="ArgumentNullException"/>
        private void InitTraceClient(ITraceClient client)
        {
            if (null == client)
            {
                throw new ArgumentNullException();
            }

            m_traceClient = client;
            m_traceOptions = m_traceClient.QueryOptions();
        }
Пример #2
0
        /// <summary>
        /// Starts the Audit helper.  
        /// From this point on, the audit helper will asyncronously process 
        /// any MailMessage objects that are passed in from Enqueue.
        /// </summary>
        public void Audit()
        {
            lock (this)
            {
                m_traceOptions = m_traceClient.QueryOptions();

                if (m_emailScanner!=null)
                {
                    m_emailScanner.SetFolders(m_traceOptions.FolderFlags);
                    m_emailWorker = new Thread(new ThreadStart(EmailScanWorker));
                    m_emailWorker.Name = "m_emailWorker";
                    m_emailWorker.Start();
                }

                if (m_fileSystemScanner != null)
                {
                    m_fileSystemScanner.SetDirectories(null);
                    m_fileSystemScanner.SetSearchFilters(null);

                    m_fileSystemWorker = new Thread(new ThreadStart(FileSystemScanWorker));
                    m_fileSystemWorker.Name = "m_fileSystemWorker";
                    m_fileSystemWorker.Start();
                }

                m_continue = true;
				m_state = AuditState.Started;
            }
        }
Пример #3
0
        /// <summary>
        /// Starts the Audit helper.  
        /// From this point on, the audit helper will process 
        /// any MailMessage objects that are encountered
        /// </summary>
        /// <remarks>Asynchronous</remarks>
        public void Audit()
        {
            lock (this)
            {
                m_traceOptions = m_traceClient.QueryOptions();  //Refreshes options between scans
				m_state = AuditState.Started;
				m_continue = true;

                if (m_fileSystemScanner != null && m_traceOptions.IsEmailScanning == false)
                {
					System.Diagnostics.Trace.WriteLine( Properties.Resources.AUDIT_FILESTART, "AuditInfo" );
                    bool isDiff = false;
					if (string.Compare(m_traceOptions.FolderToScan, m_fileSystemScanner.RootFolder, true,
						System.Threading.Thread.CurrentThread.CurrentCulture) != 0)
						isDiff = true;
					if (isDiff)
					{
						if (m_fileSystemScanner.IsCounting)
						{
							m_fileSystemScanner.EndFolderCount();
							Thread.Sleep(500); // Lets give a while to clean up.                           
						}
						m_totalFiles = 0;
						m_fileSystemScanner.BeginFolderCount(m_traceOptions.FolderToScan);
						Thread.Sleep(50); // Give it a while to queue up information
					}
                    m_traceClient.NotifyItemCount(m_totalFiles);
                    m_fileSystemScanner.BeginProcess();
                    m_traceClient.NotifyInitialMailboxName(m_fileSystemScanner.MailBox);
                }
            }
        }
Пример #4
0
        public TraceOptions QueryOptions()
        {
            TraceOptions opts = new TraceOptions
                {
                    FolderFlags = m_startup.Settings.FoldersToScan.ScanFolder,
                    AttachmentMessagesOnly = m_startup.Settings.AttachmentMessagesOnly,
                    IsEmailScanning = m_startup.Settings.ScanEmail,
                    FolderToScan = m_startup.Settings.FcsFolder,
                    RunningTests = m_startup.Settings.IsRunningTest,
                    TestFolder = m_startup.Settings.TestFolder
                };

            return opts;
        }