/// <summary>
        /// Event handler used to constantly retrieve messages from the MSMQ.
        /// </summary>
        /// <param name="sender">the sender object</param>
        /// <param name="e">the event arguments</param>
        private void queue_ReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
        {
            //recieve the messages..
            Message m = queue.EndReceive(e.AsyncResult);

            m.Formatter = new XmlMessageFormatter(new string[] { "System.String,mscorlib" });

            String receivedMessage = (string)m.Body;

            String[] splittedMessage = receivedMessage.Split('|');
            if (splittedMessage[0].Equals("OUTLOOK"))
            {
                EmailMonitor.GetInstance().ProcessEmailEvent(receivedMessage);
            }
            else
            {
                MSOFFICEFileWatcher.GetInstance().FileViewed(receivedMessage);
            }

            //once get them - send to them to consuming client
            EventSender.GetInstance().ProcessMessage((string)m.Body);

            //recieve again
            StartReceivingMessages();
        }
Beispiel #2
0
        /// <summary>
        /// Entry method.
        /// </summary>
        /// <param name="args">arguments</param>
        public static void Main(string[] args)
        {
            COMReceiver.GetInstance().DeleteAllMessages();

            EventSender.GetInstance().StartConnection(ServerInformation.LOCAL_HOST, ServerInformation.DEFAULT_PORT);

            /* Get input from COM */
            COMReceiver.GetInstance().StartReceivingMessages();

            /* Get WebPage URL from IE */
            WebPageWatcher.GetInstance().StartMonitoring();

            /* Monitors files */
            //GeneralFileWatcher.GetInstance().Start();
            FileMonitor.GetInstance().StartMonitoring();

            /* Monitors Apps/Programs */
            ProgramWatcher.GetInstance().StartMonitoring();

            /* Monitors Folder/Directories */
            FolderMonitor.GetInstance().StartMonitoring();

            // Monitor emails
            EmailMonitor.GetInstance().StartMonitoring();

            while (active)
            {
                // runs indefinitely until terminated by user via task manager
            }
        }