Example #1
0
        void OnFileSystemItemFound(object sender, FolderItemEventArgs e)
        {
            if (!m_continue)
                return;

            //need to notify clients even when we could do nothing with message.
            if (null == e.Uro)
            {
                //Skip the actual call to the audit engine. 
                //Clients need to be able to handle null notifications.
                m_traceClient.NotifyItemAudited(null);
            }
            else if (m_engine != null)
            {
                StringBuilder info = new StringBuilder();
                try
                {
                    info.AppendFormat(Properties.Resources.AUDIT_PROCESS, e.FileName);
                    System.Diagnostics.Trace.WriteLine(info.ToString(), "AuditInfo");
                    Logging.Trace.WriteLine("Passing a File as Message to the policy engine: \"" + e.FileName + "\"", "TraceAuditHelper.m_emailScanner_MailItem");

					IPolicyResponseObject pro = m_engine.ProcessConditions(Workshare.Policy.RunAt.Client, e.Uro);
					OnAuditMail(new AuditEventArgs(pro));


                }
                catch (Exception ex)
                {
                    info.Remove(0, info.Length);
                    info.AppendFormat(Properties.Resources.AUDIT_PROCESSEX, e.FileName, ex.Message);
                    System.Diagnostics.Trace.WriteLine(info.ToString(), "AuditInfo");
                    m_traceClient.NotifyItemAudited(null);
                    Logging.Trace.WriteLine(ex.Message, "TraceAuditManager.OnFileSystemItemFound Exception");
                }
            }
            e.Dispose();
        }