Пример #1
0
 public BaseEvent()
 {
     m_TimeStamp = DateTime.Now;
       m_Source = string.Empty;
       m_ThreadInfo = null;
       m_CallingMethod = null;
       m_StackDepth = 0;
       m_Message = string.Empty;
       m_Bag = new PropertyBag();
       m_Severity = EventSeverity.Trace;
       m_EventID = 0;
       m_EventCategoryID = 0;
       try
       {
     StackTrace trace1 = new StackTrace(false);
     int num1 = 2;
     Type type1 = null;
     do
     {
       num1++;
       m_CallingMethod = trace1.GetFrame(num1).GetMethod();
       type1 = m_CallingMethod.DeclaringType;
     } while ((num1 < trace1.FrameCount) &&
          (typeof (ISkipStackFrame).IsAssignableFrom(type1) || type1.FullName.StartsWith("System.")));
     m_StackDepth = (trace1.FrameCount - num1) + 1;
       }
       catch
       {
     m_CallingMethod = null;
       }
       if (m_CallingMethod != null)
       {
     m_Source = m_CallingMethod.DeclaringType.FullName;
       }
       m_ThreadInfo = Instrumentation.CurrentThreadName;
       m_WindowsIdentityName = (string) m_IdentityCache[m_ThreadInfo];
       if (m_WindowsIdentityName == null)
       {
     m_WindowsIdentityName = WindowsIdentity.GetCurrent().Name;
     m_IdentityCache.Add(m_ThreadInfo, m_WindowsIdentityName);
       }
 }
Пример #2
0
 protected BaseEvent(SerializationInfo info, StreamingContext context)
 {
     m_TimeStamp = DateTime.Now;
       m_Source = string.Empty;
       m_ThreadInfo = null;
       m_CallingMethod = null;
       m_StackDepth = 0;
       m_Message = string.Empty;
       m_Bag = new PropertyBag();
       m_Severity = EventSeverity.Trace;
       m_EventID = 0;
       m_EventCategoryID = 0;
       m_TimeStamp = info.GetDateTime("timestamp");
       m_Source = info.GetString("source");
       m_ThreadInfo = info.GetString("threadinfo");
       m_StackDepth = info.GetInt32("stackdepth");
       m_Message = info.GetString("message");
       m_WindowsIdentityName = info.GetString("windowsidentity");
       m_EventID = info.GetInt32("eventid");
       m_EventCategoryID = info.GetInt16("categoryid");
       int num1 = info.GetInt32("severity");
       m_Severity = EventSeverity.Parse(num1);
       int num2 = info.GetInt32("propcount");
       for (int num3 = 0; num3 < num2; num3++)
       {
     string text1 = info.GetString("propname-" + num3.ToString());
     string text2 = info.GetString("propvalue-" + num3.ToString());
     m_Bag.Add(text1, text2);
       }
 }