// Token: 0x06000155 RID: 341 RVA: 0x0000A68C File Offset: 0x0000888C
 internal static void LogTimeInLiveIdModule(HttpContext httpContext)
 {
     if (!LogonLatencyLogger.loggingEnabled)
     {
         return;
     }
     try
     {
         DateTime?dateTime = httpContext.Items["RequestStartTime"] as DateTime?;
         if (dateTime != null && dateTime != null)
         {
             DateTime utcNow    = DateTime.UtcNow;
             long     latency   = Convert.ToInt64((utcNow - dateTime.Value).TotalMilliseconds);
             long     latency2  = -1L;
             DateTime?dateTime2 = httpContext.Items["AdRequestStartTime"] as DateTime?;
             DateTime?dateTime3 = httpContext.Items["AdRequestEndTime"] as DateTime?;
             if (dateTime2 != null && dateTime2 != null && dateTime3 != null && dateTime3 != null)
             {
                 latency2 = Convert.ToInt64((dateTime3.Value - dateTime2.Value).TotalMilliseconds);
             }
             httpContext.Response.AppendToLog(string.Format("&lvidmdlltncy={0}&lvidadlookupltncy={1}", latency.ToString(), latency2.ToString()));
             LogonLatencyLogger.AddLatencyHeader(httpContext, "X-AuthDiagInfoLiveIdModuleLatency", latency);
             LogonLatencyLogger.AddLatencyHeader(httpContext, "X-AuthDiagInfoLiveIdModuleAdLookupLatency", latency2);
             httpContext.Items["RequestStartTime"] = null;
         }
     }
     catch (Exception arg)
     {
         ExTraceGlobals.PerformanceTracer.TraceDebug <Exception>(0L, "Exception happened while trying to Log Time In LiveIdModule. Exception will be ignored: {0}", arg);
     }
 }
 // Token: 0x06000151 RID: 337 RVA: 0x0000A1A0 File Offset: 0x000083A0
 internal static void UpdateCookie(HttpContext httpContext, string action, DateTime checkPointDateTime)
 {
     try
     {
         if (LogonLatencyLogger.loggingEnabled)
         {
             DateTime utcNow  = DateTime.UtcNow;
             long     latency = Convert.ToInt64((utcNow - checkPointDateTime).TotalMilliseconds);
             if (action.Equals("ADL"))
             {
                 LogonLatencyLogger.AddLatencyHeader(httpContext, "X-AuthDiagInfoLdapLatency", latency);
             }
             else
             {
                 LogonLatencyLogger.AddLatencyHeader(httpContext, "X-AuthDiagInfoMservLookupLatency", latency);
             }
             string text        = string.Empty;
             string cookieValue = string.Empty;
             if (httpContext.Request.Cookies["logonLatency"] != null && httpContext.Request.Cookies["logonLatency"].Value != null)
             {
                 text = LogonLatencyLogger.GetLatestCookieValue(httpContext);
                 if (action.Equals("ADL") || action.Equals("MSERVL"))
                 {
                     int num = 1;
                     if (!string.IsNullOrEmpty(text))
                     {
                         while (text.Contains(action + num))
                         {
                             num++;
                         }
                     }
                     action += num;
                 }
                 cookieValue = string.Format("{0}&{1}={2}", text, action, latency.ToString());
                 LogonLatencyLogger.SetCookie(httpContext, "logonLatency", cookieValue, Utilities.GetOutlookDotComDomain(httpContext.Request.GetRequestUrlEvenIfProxied().Host));
             }
             else
             {
                 string arg = "adlkupltncy";
                 if (action.Equals("MSERVL"))
                 {
                     arg = "mservlkupltncy";
                 }
                 httpContext.Response.AppendToLog(string.Format("&{0}={1}", arg, latency.ToString()));
             }
         }
     }
     catch (Exception ex)
     {
         ExTraceGlobals.LiveIdAuthenticationModuleTracer.TraceError <string, string>(0L, "Unexpected exception while updating logon latency cookie. Exception message: {0}. Stack trace: {1}", ex.Message, ex.StackTrace);
     }
 }
 // Token: 0x06000150 RID: 336 RVA: 0x0000A118 File Offset: 0x00008318
 internal static void CreateCookie(HttpContext httpContext, string logonStep)
 {
     try
     {
         if (LogonLatencyLogger.loggingEnabled)
         {
             LogonLatencyLogger.SetCookie(httpContext, "logonLatency", string.Format("{0}={1}", logonStep, DateTime.UtcNow.Ticks.ToString()), Utilities.GetOutlookDotComDomain(httpContext.Request.GetRequestUrlEvenIfProxied().Host));
         }
     }
     catch (Exception ex)
     {
         ExTraceGlobals.LiveIdAuthenticationModuleTracer.TraceError <string, string>(0L, "Unexpected exception while creating logon latency cookie. Exception message: {0}. Stack trace: {1}", ex.Message, ex.StackTrace);
     }
 }
 // Token: 0x06000153 RID: 339 RVA: 0x0000A424 File Offset: 0x00008624
 internal static void WriteLatencyToIISLogAndDeleteCookie(HttpContext httpContext)
 {
     try
     {
         if (LogonLatencyLogger.loggingEnabled)
         {
             long num  = -1L;
             long num2 = -1L;
             NameValueCollection nameValueCollection = new NameValueCollection();
             StringBuilder       stringBuilder       = new StringBuilder();
             if (httpContext.Request.Cookies["logonLatency"] != null && httpContext.Request.Cookies["logonLatency"].Value != null)
             {
                 nameValueCollection          = HttpUtility.ParseQueryString(LogonLatencyLogger.GetLatestCookieValue(httpContext));
                 nameValueCollection["LGN04"] = DateTime.UtcNow.Ticks.ToString();
                 LogonLatencyLogger.AssignLatency(nameValueCollection, "LGN02", "LGN01", ref num);
                 LogonLatencyLogger.AssignLatency(nameValueCollection, "LGN04", "LGN02", ref num2);
                 stringBuilder.AppendFormat("&livelgnltncy={0}&resubrpsltncy={1}", num.ToString(), num2.ToString());
                 for (int i = 1; i <= 5; i++)
                 {
                     if (nameValueCollection["ADL" + i] != null)
                     {
                         stringBuilder.AppendFormat("&adlkupltncy{0}={1}", i, nameValueCollection["ADL" + i]);
                     }
                 }
                 for (int j = 1; j <= 3; j++)
                 {
                     if (nameValueCollection["MSERVL" + j] != null)
                     {
                         stringBuilder.AppendFormat("&mservlkupltncy{0}={1}", j, nameValueCollection["MSERVL" + j]);
                     }
                 }
             }
             if (!stringBuilder.ToString().Contains("adlkupltncy1"))
             {
                 stringBuilder.AppendFormat("&adlkupltncy1=-1", new object[0]);
             }
             httpContext.Response.AppendToLog(stringBuilder.ToString());
             httpContext.Items["logonLatency"] = stringBuilder.ToString();
             LogonLatencyLogger.DeleteCookie(httpContext);
         }
     }
     catch (Exception ex)
     {
         ExTraceGlobals.LiveIdAuthenticationModuleTracer.TraceError <string, string>(0L, "Unexpected exception while writing logon latency to IIS. Exception message: {0}. Stack trace: {1}", ex.Message, ex.StackTrace);
     }
 }
 // Token: 0x06000152 RID: 338 RVA: 0x0000A34C File Offset: 0x0000854C
 internal static void UpdateCookie(HttpContext httpContext, string logonStep)
 {
     try
     {
         if (LogonLatencyLogger.loggingEnabled)
         {
             string arg         = string.Empty;
             string cookieValue = string.Empty;
             if (httpContext.Request.Cookies["logonLatency"] != null && httpContext.Request.Cookies["logonLatency"].Value != null)
             {
                 arg         = LogonLatencyLogger.GetLatestCookieValue(httpContext);
                 cookieValue = string.Format("{0}&{1}={2}", arg, logonStep, DateTime.UtcNow.Ticks.ToString());
                 LogonLatencyLogger.SetCookie(httpContext, "logonLatency", cookieValue, Utilities.GetOutlookDotComDomain(httpContext.Request.GetRequestUrlEvenIfProxied().Host));
             }
         }
     }
     catch (Exception ex)
     {
         ExTraceGlobals.LiveIdAuthenticationModuleTracer.TraceError <string, string>(0L, "Unexpected exception while updating logon latency cookie. Exception message: {0}. Stack trace: {1}", ex.Message, ex.StackTrace);
     }
 }