Example #1
0
        public ProcessWatcher(IProcessProxy processProxy, IProcessDiscoveryMethod discoveryMethod)
        {
            if (IntPtr.Size != 4)
            {
                logger.Warn("Process Stalker: IntPtr Size != 4"); //Ensure we're running in 32-bit or WoW64
            }
            this.processProxy    = processProxy;
            this.discoveryMethod = discoveryMethod;

            //Bubble events from our stalker method to the event handlers of the process stalker
            discoveryMethod.ProcessDiscovered += (a, b) => {
                var capture = NewProcessFound;
                if (capture != null)
                {
#if !DEBUG
                    try {
#endif
                    capture(a, b);
#if !DEBUG
                }
                catch (Exception e) {
                    logger.Error("ERROR: " + e.ToString());
                    throw;
                }
#endif
                }
            };
        }
        public ProcessWatcher(IProcessProxy processProxy, IProcessDiscoveryMethod discoveryMethod)
        {
            if (IntPtr.Size != 4)
            logger.Warn("Process Stalker: IntPtr Size != 4"); //Ensure we're running in 32-bit or WoW64

             this.processProxy = processProxy;
             this.discoveryMethod = discoveryMethod;

             //Bubble events from our stalker method to the event handlers of the process stalker
             discoveryMethod.ProcessDiscovered += (a, b) => {
            var capture = NewProcessFound;
            if (capture != null) {
            #if !DEBUG
               try {
            #endif
                  capture(a, b);
            #if !DEBUG
               } catch (Exception e) {
                  logger.Error("ERROR: " + e.ToString());
                  throw;
               }
            #endif
            }
             };
        }