示例#1
0
        private List <Tuple <EventProvider.SessionInfo, bool> > GetSessions()
        {
            List <EventProvider.SessionInfo> liveSessionList = (List <EventProvider.SessionInfo>)null;

            this.GetSessionInfo((Action <int, long>)((etwSessionId, matchAllKeywords) => EventProvider.GetSessionInfoCallback(etwSessionId, matchAllKeywords, ref liveSessionList)));
            List <Tuple <EventProvider.SessionInfo, bool> > tupleList = new List <Tuple <EventProvider.SessionInfo, bool> >();

            if (this.m_liveSessions != null)
            {
                foreach (EventProvider.SessionInfo mLiveSession in this.m_liveSessions)
                {
                    int index;
                    if ((index = EventProvider.IndexOfSessionInList(liveSessionList, mLiveSession.etwSessionId)) < 0 || liveSessionList[index].sessionIdBit != mLiveSession.sessionIdBit)
                    {
                        tupleList.Add(Tuple.Create <EventProvider.SessionInfo, bool>(mLiveSession, false));
                    }
                }
            }
            if (liveSessionList != null)
            {
                foreach (EventProvider.SessionInfo sessionInfo in liveSessionList)
                {
                    int index;
                    if ((index = EventProvider.IndexOfSessionInList(this.m_liveSessions, sessionInfo.etwSessionId)) < 0 || this.m_liveSessions[index].sessionIdBit != sessionInfo.sessionIdBit)
                    {
                        tupleList.Add(Tuple.Create <EventProvider.SessionInfo, bool>(sessionInfo, true));
                    }
                }
            }
            this.m_liveSessions = liveSessionList;
            return(tupleList);
        }
        private List <Tuple <EventProvider.SessionInfo, bool> > GetSessions()
        {
            List <EventProvider.SessionInfo> liveSessionList = null;

            this.GetSessionInfo(delegate(int etwSessionId, long matchAllKeywords)
            {
                EventProvider.GetSessionInfoCallback(etwSessionId, matchAllKeywords, ref liveSessionList);
            });
            List <Tuple <EventProvider.SessionInfo, bool> > list = new List <Tuple <EventProvider.SessionInfo, bool> >();

            if (this.m_liveSessions != null)
            {
                foreach (EventProvider.SessionInfo sessionInfo in this.m_liveSessions)
                {
                    int index;
                    if ((index = EventProvider.IndexOfSessionInList(liveSessionList, sessionInfo.etwSessionId)) < 0 || liveSessionList[index].sessionIdBit != sessionInfo.sessionIdBit)
                    {
                        list.Add(Tuple.Create <EventProvider.SessionInfo, bool>(sessionInfo, false));
                    }
                }
            }
            if (liveSessionList != null)
            {
                foreach (EventProvider.SessionInfo sessionInfo2 in liveSessionList)
                {
                    int index2;
                    if ((index2 = EventProvider.IndexOfSessionInList(this.m_liveSessions, sessionInfo2.etwSessionId)) < 0 || this.m_liveSessions[index2].sessionIdBit != sessionInfo2.sessionIdBit)
                    {
                        list.Add(Tuple.Create <EventProvider.SessionInfo, bool>(sessionInfo2, true));
                    }
                }
            }
            this.m_liveSessions = liveSessionList;
            return(list);
        }