Esempio n. 1
0
 private ActivitySession(MailboxSession session, ActivitySession.ClientInfo clientInfo, IActivityLogger activityLogger)
 {
     Util.ThrowOnNullArgument(activityLogger, "activityLogger");
     this.session    = session;
     this.clientInfo = clientInfo;
     this.logger     = activityLogger;
 }
Esempio n. 2
0
        private static ActivitySession.ClientInfo ExtractClientInfo(MailboxSession mailboxSession)
        {
            ActivitySession.ClientInfo clientInfo = new ActivitySession.ClientInfo
            {
                Id      = ClientId.Other,
                Version = "15.00.1497.012"
            };
            string text = (mailboxSession == null || mailboxSession.ClientInfoString == null) ? string.Empty : mailboxSession.ClientInfoString;

            if (text.Equals("Client=MSExchangeRPC", StringComparison.OrdinalIgnoreCase) && ActivityContext.GetCurrentActivityScope() != null)
            {
                clientInfo = ActivitySession.ExtractMapiClientInfo(ActivityContext.GetCurrentActivityScope().ClientInfo, clientInfo);
            }
            else if (text.IndexOf("macoutlook", StringComparison.OrdinalIgnoreCase) != -1)
            {
                clientInfo.Id = ClientId.MacOutlook;
            }
            else if (text.IndexOf("Client=OWA", StringComparison.OrdinalIgnoreCase) != -1)
            {
                clientInfo.Id = ClientId.Web;
            }
            else if (text.IndexOf("Client=ActiveSync", StringComparison.OrdinalIgnoreCase) != -1)
            {
                clientInfo.Id = ClientId.Mobile;
            }
            else if (text.StartsWith("Client=Hub Transport", StringComparison.OrdinalIgnoreCase))
            {
                clientInfo.Id = ClientId.Exchange;
            }
            else if (text.StartsWith("Client=POP3/IMAP4;Protocol=POP3", StringComparison.OrdinalIgnoreCase))
            {
                clientInfo.Id = ClientId.POP3;
            }
            else if (text.StartsWith("Client=POP3/IMAP4;Protocol=IMAP4", StringComparison.OrdinalIgnoreCase))
            {
                clientInfo.Id = ClientId.IMAP4;
            }
            else
            {
                clientInfo.Id = ClientId.Other;
            }
            clientInfo.Id = clientInfo.Id.GetServerSideInstrumentationVariant(true);
            return(clientInfo);
        }
Esempio n. 3
0
        public static ActivitySession Create(MailboxSession session)
        {
            Util.ThrowOnNullArgument(session, "session");
            if (!ActivityLogHelper.IsActivityLoggingEnabled(false))
            {
                return(null);
            }
            if (session.LogonType == LogonType.Delegated || session.LogonType == LogonType.DelegatedAdmin)
            {
                ExTraceGlobals.SessionTracer.TraceDebug(0L, "Skipping Activity Logging since session is from delegate.");
                return(null);
            }
            IActivityLogger activityLogger = ActivityLogger.Create(session);

            if (activityLogger == null)
            {
                ExTraceGlobals.SessionTracer.TraceDebug(0L, "Skipping Activity Logging since the activity logger couldn't be created");
                return(null);
            }
            ActivitySession.ClientInfo clientInfo = ActivitySession.ExtractClientInfo(session);
            return(new ActivitySession(session, clientInfo, activityLogger));
        }
Esempio n. 4
0
        private static ActivitySession.ClientInfo ExtractMapiClientInfo(string mapiClientString, ActivitySession.ClientInfo info)
        {
            if (string.IsNullOrEmpty(mapiClientString))
            {
                return(info);
            }
            string[] array = mapiClientString.Split(new char[]
            {
                '/'
            });
            ClientId id;

            if (ActivitySession.MapiClientIds.TryGetValue(array[0].ToLowerInvariant(), out id))
            {
                info.Id = id;
            }
            if (array.Length > 2 && !string.IsNullOrEmpty(array[1]))
            {
                info.Version = array[1];
            }
            return(info);
        }