// Token: 0x0600343A RID: 13370 RVA: 0x000CA420 File Offset: 0x000C8620
        public static EtwSession GetEtwSession(int etwSessionId, bool bCreateIfNeeded = false)
        {
            if (etwSessionId < 0)
            {
                return(null);
            }
            EtwSession etwSession;

            foreach (WeakReference <EtwSession> weakReference in EtwSession.s_etwSessions)
            {
                if (weakReference.TryGetTarget(out etwSession) && etwSession.m_etwSessionId == etwSessionId)
                {
                    return(etwSession);
                }
            }
            if (!bCreateIfNeeded)
            {
                return(null);
            }
            if (EtwSession.s_etwSessions == null)
            {
                EtwSession.s_etwSessions = new List <WeakReference <EtwSession> >();
            }
            etwSession = new EtwSession(etwSessionId);
            EtwSession.s_etwSessions.Add(new WeakReference <EtwSession>(etwSession));
            if (EtwSession.s_etwSessions.Count > 16)
            {
                EtwSession.TrimGlobalList();
            }
            return(etwSession);
        }
Exemple #2
0
        public static EtwSession GetEtwSession(int etwSessionId, bool bCreateIfNeeded = false)
        {
            if (etwSessionId < 0)
            {
                return((EtwSession)null);
            }
            foreach (WeakReference <EtwSession> sEtwSession in EtwSession.s_etwSessions)
            {
                EtwSession target;
                if (sEtwSession.TryGetTarget(out target) && target.m_etwSessionId == etwSessionId)
                {
                    return(target);
                }
            }
            if (!bCreateIfNeeded)
            {
                return((EtwSession)null);
            }
            if (EtwSession.s_etwSessions == null)
            {
                EtwSession.s_etwSessions = new List <WeakReference <EtwSession> >();
            }
            EtwSession target1 = new EtwSession(etwSessionId);

            EtwSession.s_etwSessions.Add(new WeakReference <EtwSession>(target1));
            if (EtwSession.s_etwSessions.Count > 16)
            {
                EtwSession.TrimGlobalList();
            }
            return(target1);
        }
 // Token: 0x0600343B RID: 13371 RVA: 0x000CA4CC File Offset: 0x000C86CC
 public static void RemoveEtwSession(EtwSession etwSession)
 {
     if (EtwSession.s_etwSessions == null || etwSession == null)
     {
         return;
     }
     EtwSession.s_etwSessions.RemoveAll(delegate(WeakReference <EtwSession> wrEtwSession)
     {
         EtwSession etwSession2;
         return(wrEtwSession.TryGetTarget(out etwSession2) && etwSession2.m_etwSessionId == etwSession.m_etwSessionId);
     });
     if (EtwSession.s_etwSessions.Count > 16)
     {
         EtwSession.TrimGlobalList();
     }
 }
Exemple #4
0
 public static void RemoveEtwSession(EtwSession etwSession)
 {
     if (EtwSession.s_etwSessions == null || etwSession == null)
     {
         return;
     }
     EtwSession.s_etwSessions.RemoveAll((Predicate <WeakReference <EtwSession> >)(wrEtwSession =>
     {
         EtwSession target;
         if (wrEtwSession.TryGetTarget(out target))
         {
             return(target.m_etwSessionId == etwSession.m_etwSessionId);
         }
         return(false);
     }));
     if (EtwSession.s_etwSessions.Count <= 16)
     {
         return;
     }
     EtwSession.TrimGlobalList();
 }