コード例 #1
0
        private void ProbeEvent(EventSchema eventSchema, EventSource source)
        {
            using (var listener = new ProbeEventListener(eventSchema, this))
            {
                try
                {
                    listener.EnableEvents(source, eventSchema.Level, eventSchema.Keywords);
                    MethodInfo method;
                    if (this.TryInvokeMethod(eventSchema, source, listener, out method))
                    {
                        if (listener.EventData == null)
                        {
                            throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Resources.EventSourceAnalyzerMissingWriteEventCallError, method.Name));
                        }

                        if (listener.Error != null)
                        {
                            throw listener.Error;
                        }
                    }
                }
                finally
                {
                    listener.DisableEvents(source);
                }
            }
        }
コード例 #2
0
 private void CheckEnableEvents(EventSource eventSource)
 {
     using (var listener = new ProbeEventListener())
     {
         //// EnableEvents will do a general validation pass
         listener.EnableEvents(eventSource, EventLevel.LogAlways);
         //// Restore source
         listener.DisableEvents(eventSource);
     }
 }
コード例 #3
0
        private void ProbeEvent(EventSchema eventSchema, EventSource source)
        {
            using (var listener = new ProbeEventListener(eventSchema, this))
            {
                try
                {
                    listener.EnableEvents(source, eventSchema.Level, eventSchema.Keywords);
                    MethodInfo method;
                    if (this.TryInvokeMethod(eventSchema, source, listener, out method))
                    {
                        if (listener.EventData == null)
                        {
                            throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerMissingWriteEventCallError, method.Name));
                        }

                        if (listener.Error != null)
                        {
                            throw listener.Error;
                        }
                    }
                }
                finally
                {
                    listener.DisableEvents(source);
                }
            }
        }
コード例 #4
0
 private void CheckEnableEvents(EventSource eventSource)
 {
     using (var listener = new ProbeEventListener())
     {
         //// EnableEvents will do a general validation pass
         listener.EnableEvents(eventSource, EventLevel.LogAlways);
         //// Restore source
         listener.DisableEvents(eventSource);
     }
 }