Exemplo n.º 1
0
        /// <summary>
        /// 获取脉冲宽度
        /// </summary>
        /// <param name="ChannelNumber"></param>
        /// <returns></returns>
        public override double GetPulseWidth(int ChannelNumber)
        {
            string ResultsString;

            string[] ResultsList;
            double   Result = -999;

            int i = 0;

            do
            {
                System.Threading.Thread.Sleep(10);
                ResultsString = base.Query("FETCh" + ChannelNumber.ToString() + ":ARRay:AMEAsure:TIMe?");
                ResultsList   = ResultsString.Split(',');
                i++;
            }while (ResultsList.Length < 18 && i < 10);

            if (ResultsList.Length < 18)
            {
                return(-999);
            }

            if (ResultsList[4] == "1")
            {
                if (!double.TryParse(ResultsList[5], out Result))
                {
                    Result = -999;
                }
                return(Result);
            }
            else
            {
                return(-999);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取marker2的值
        /// </summary>
        /// <param name="ChannelNumber"></param>
        /// <returns></returns>
        public override double GetMarker2Value(int ChannelNumber)
        {
            string ResultsString;

            string[] ResultsList;
            double   Result = -999;

            int i = 0;

            do
            {
                System.Threading.Thread.Sleep(10);
                ResultsString = base.Query("FETCh" + ChannelNumber.ToString() + ":ARRay:MARKer:POWer?");
                ResultsList   = ResultsString.Split(',');
                i++;
            }while (ResultsList.Length < 14 && i < 10);

            if (ResultsList.Length < 14)
            {
                return(-999);
            }

            if (ResultsList[10] == "1")
            {
                if (!double.TryParse(ResultsList[11], out Result))
                {
                    Result = -999;
                }
                return(Result);
            }
            else
            {
                return(-999);
            }
        }
Exemplo n.º 3
0
        public override double MeasurePower(int ChannelNumber)
        {
            string ResultsString;

            string[] ResultsList;
            double   Result = -999;

            int i = 0;

            do
            {
                System.Threading.Thread.Sleep(10);
                ResultsString = base.Query("MEASure" + ChannelNumber.ToString() + ":POWer?");
                ResultsList   = ResultsString.Split(',');
                i++;
            }while (ResultsList.Length < 2 && i < 10);

            if (ResultsList.Length < 2)
            {
                return(-999);
            }

            if (ResultsList[0] == "1")
            {
                if (!double.TryParse(ResultsList[1], out Result))
                {
                    Result = -999;
                }
                return(Result);
            }
            else
            {
                return(-999);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取脉冲下降沿时间
        /// </summary>
        /// <param name="ChannelNumber"></param>
        /// <returns></returns>
        public override double GetPulseFallTime(int ChannelNumber)
        {
            byte[] ResultsBytes;
            string ResultsString;

            string[] ResultsList;
            double   Result = -999;

            int count = 0;
            int i     = 0;

            do
            {
                System.Threading.Thread.Sleep(10);
                base.Send("FETCh" + ChannelNumber.ToString() + ":ARRay:AMEAsure:TIMe?");
                System.Threading.Thread.Sleep(10);
                base.Read(out ResultsBytes, ref count);
                ResultsString = Encoding.Default.GetString(ResultsBytes);
                ResultsList   = ResultsString.Split(',');
                i++;
            }while (ResultsList.Length < 18 && i < 10);

            if (ResultsList.Length < 18)
            {
                return(-999);
            }

            if (ResultsList[12] == "1")
            {
                if (!double.TryParse(ResultsList[13], out Result))
                {
                    Result = -999;
                }
                return(Result);
            }
            else
            {
                return(-999);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取连续波最大功率值
        /// </summary>
        /// <param name="ChannelNumber"></param>
        /// <returns></returns>
        public override double GetCWMaxValue(int ChannelNumber)
        {
            byte[] ResultsBytes;
            string ResultsString;

            string[] ResultsList;
            double   Result = -999;

            int count = 0;
            int i     = 0;

            do
            {
                System.Threading.Thread.Sleep(10);
                base.Send("FETCH" + ChannelNumber.ToString() + ":ARRay:CW:POWer?");
                System.Threading.Thread.Sleep(30);
                base.Read(out ResultsBytes, ref count);
                ResultsString = Encoding.Default.GetString(ResultsBytes);
                ResultsList   = ResultsString.Split(',');
                i++;
            }while (ResultsList.Length < 8 && i < 10);
            if (ResultsList.Length < 8)
            {
                return(-999);
            }
            else if (ResultsList[2] == "1")
            {
                if (!double.TryParse(ResultsList[3], out Result))
                {
                    return(-999);
                }
                return(Result);
            }
            else
            {
                return(-999);
            }
        }
        /// <summary>
        ///  Parse the HTTP payload to FSSHTTP and WOPI message.
        /// </summary>
        /// <param name="_session"></param>
        /// <returns></returns>
        public async Task ParseHTTPResponse(Session session)
        {
            try
            {
                // Extension disabled.
                if (!Preferences.ExtensionEnabled)
                {
                    // Clear ResultsString.
                    Clear();
                    ResultsString.AppendLine("<br /><h2>Office 365 Fiddler Extension Disabled</h2>");
                    Office365ResponseControl.ResultsOutput.DocumentText = ResultsString.ToString();
                    return;
                }

                if (!this.session.isFlagSet(SessionFlags.LoadedFromSAZ))
                {
                    // Clear ResultsString.
                    Clear();
                    ResultsString.AppendLine("<br /><h2><span style='color:red'>Session analysis not available on live sessions.</span></h2>");
                    ResultsString.AppendLine("<p>Live analysis of sessions is known to provide inaccurate results.</p>"
                                             + "<p>Save these sessions as a SAZ file and load them back into Fiddler. Click <i>File, Save, All Sessions</i>.</p>"
                                             + "<p>Then click File, Load Archive... to open the SAZ file.</p>"
                                             + "</font></body></html>");
                    Office365ResponseControl.ResultsOutput.DocumentText = ResultsString.ToString();
                    return;
                }

                // Clear ResultsString.
                Clear();

                this.session = session;

                // HTML Header.
                ResultsString.AppendLine("<html>");
                ResultsString.AppendLine("<title></title>");
                ResultsString.AppendLine("<head></head>");
                ResultsString.AppendLine("<body>");
                ResultsString.AppendLine("<font face='open-sans'>");

                ResultsString.Append(FiddlerApplication.Prefs.GetStringPref("extensions.Office365.UpdateMessage", ""));

                // General Session Data.
                #region GeneralSessionData

                ResultsString.AppendLine("<br />");

                ResultsString.AppendLine("<h2>General Session Data</h2>");

                ResultsString.AppendLine("<table border='0'>");
                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td width='150px'>");
                ResultsString.AppendLine("Session Id");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.id.ToString());
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Response Code");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine($"<a href='https://en.wikipedia.org/wiki/List_of_HTTP_status_codes' target='_blank'>{this.session["X-ResponseCodeDescription"]}</a>");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Session Captured");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session["X-DataCollected"]);
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Session Analysis");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(DateTime.Now.ToString("dddd, dd MMMM yyyy"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Capture was");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session["X-DataAge"]);
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Process");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session["X-ProcessName"]);
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                if (this.session["X-ResponseServer"] != null)
                {
                    ResultsString.AppendLine("<tr>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine("Response Server");
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine(this.session["X-ResponseServer"]);
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("</tr>");
                }

                if (this.session["X-InspectorElapsedTime"] != "Insufficient data")
                {
                    ResultsString.AppendLine("<tr>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine("Elapsed Time");
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine(this.session["X-InspectorElapsedTime"]);
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("</tr>");
                }

                ResultsString.AppendLine("</table>");
                #endregion

                // Session Analysis.
                ResultsString.AppendLine("<h2>Session Analysis</h2>");

                ResultsString.AppendLine($"<p>{this.session["X-ResponseComments"]}</p>");

                // Session Age.
                ResultsString.AppendLine($"<h2>Session Age</h2>");

                ResultsString.AppendLine($"<p>{this.session["X-CalculatedSessionAge"]}</p>");

                // Authentication
                #region Authentication
                if (this.session["X-AUTHENTICATION"] != "No Auth Headers")
                {
                    ResultsString.AppendLine("<h2>Authentication</h2>");

                    ResultsString.AppendLine($"<h3>{this.session["X-AUTHENTICATION"]}</h3>");

                    ResultsString.AppendLine($"<p>{this.session["X-AUTHENTICATIONDESC"]}</p>");
                }

                if (this.session["X-Office365AuthType"] == "SAMLResponseParser")
                {
                    ResultsString.AppendLine("<h2>SAML Response Parser</h2>");

                    ResultsString.AppendLine("<table border='0'>");
                    ResultsString.AppendLine("<tr>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine("Issuer");
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine(this.session["X-ISSUER"]);
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("</tr>");

                    ResultsString.AppendLine("<tr>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine("Attribute Name Immutable Id");
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine(this.session["X-ATTRIBUTENAMEIMMUTABLEID"]);
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("</tr>");

                    ResultsString.AppendLine("<tr>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine("Attribute Name UPN");
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine(this.session["X-ATTRIBUTENAMEUPN"]);
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("</tr>");

                    ResultsString.AppendLine("<tr>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine("Name Identifier Format");
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("<td>");
                    ResultsString.AppendLine(this.session["X-NAMEIDENTIFIERFORMAT"]);
                    ResultsString.AppendLine("</td>");
                    ResultsString.AppendLine("</tr>");

                    ResultsString.AppendLine("</table>");

                    ResultsString.AppendLine("<p>Copy and save the below text into a .cer file to view the signing certificate.</p>");
                    ResultsString.AppendLine("-----BEGIN CERTIFICATE-----<br />");
                    ResultsString.AppendLine($"{this.session["X-SigningCertificate"]}<br />");
                    ResultsString.AppendLine("-----END CERTIFICATE-----");
                }
                #endregion

                // Session Timers.
                #region SessionTimers
                ResultsString.AppendLine("<h2>Overall Session Timers</h2>");

                ResultsString.AppendLine("<table border='0'>");
                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td width='150px'>");
                ResultsString.AppendLine("Client Connected");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.ClientConnected.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Client Begin Request");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.ClientBeginRequest.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Got Request Headers");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.FiddlerGotRequestHeaders.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Client Done Response");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.ClientDoneResponse.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Elapsed Time");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session["X-InspectorElapsedTime"]);
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("</table>");
                #endregion

                // Server Timers.
                #region ServerTimers
                ResultsString.AppendLine("<h2>Server Timers</h2>");

                ResultsString.AppendLine("<table border='0'>");
                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td width='150px'>");
                ResultsString.AppendLine("Fiddler Begin Request");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.FiddlerBeginRequest.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Server Got Request");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.ServerGotRequest.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Server Begin Response");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.ServerBeginResponse.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Got Response Headers");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.FiddlerGotResponseHeaders.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Server Done Response");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session.Timers.ServerDoneResponse.ToString("yyyy/MM/dd H:mm:ss.fff tt"));
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Server Think Time");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session["X-ServerThinkTime"]);
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("<tr>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine("Transit Time");
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("<td>");
                ResultsString.AppendLine(this.session["X-TransitTime"]);
                ResultsString.AppendLine("</td>");
                ResultsString.AppendLine("</tr>");

                ResultsString.AppendLine("</table>");
                #endregion

                ResultsString.AppendLine($"<p>{this.session["X-SessionTimersDescription"]}</p>");

                ResultsString.AppendLine("<p>For an explantion of session timers refer to: <a href='https://aka.ms/Timers-Definitions' target='_blank'>https://aka.ms/Timers-Definitions</a>.</p>");

                // HTML Footer.
                ResultsString.AppendLine("</font>");
                ResultsString.AppendLine("</body>");
                ResultsString.AppendLine("</html>");

                Office365ResponseControl.ResultsOutput.DocumentText = ResultsString.ToString();
            }
            catch (Exception ex)
            {
                ResultsString.AppendLine();
                ResultsString.AppendLine(ex.Message);
                ResultsString.AppendLine();

                Office365ResponseControl.ResultsOutput.DocumentText = ResultsString.ToString();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        ///  Parse the HTTP payload to FSSHTTP and WOPI message.
        /// </summary>
        /// <param name="_session"></param>
        /// <returns></returns>
        public async Task ParseHTTPResponse(Session _session)
        {
            try
            {
                if (!Preferences.ExtensionEnabled)
                {
                    Clear();
                    ResultsString.AppendLine("-------------------------------");
                    ResultsString.AppendLine("O365 Fiddler Extension Disabled.");
                    ResultsString.AppendLine("-------------------------------");
                    ExchangeResponseControl.ResultsOutput.AppendText(ResultsString.ToString());
                    return;
                }

                Clear();

                this.session = _session;

                this.session.utilDecodeRequest(true);
                this.session.utilDecodeResponse(true);

                //this.Clear();

                ResultsString.Append(FiddlerApplication.Prefs.GetStringPref("extensions.EXOFiddlerExtension.UpdateMessage", ""));

                ResultsString.AppendLine("General Session Data");
                ResultsString.AppendLine("--------------------");
                ResultsString.AppendLine();

                // Write data into Session Type and session ID.
                ResultsString.AppendLine($"Session Id: {this.session.id.ToString()}");

                ResultsString.AppendLine($"HTTP Response Code: {this.session.responseCode.ToString()}");

                // Write Data age data into textbox.
                String TimeSpanDaysText    = "";
                String TimeSpanHoursText   = "";
                String TimeSpanMinutesText = "";

                DateTime SessionDateTime = this.session.Timers.ClientBeginRequest;
                DateTime DateTimeNow     = DateTime.Now;
                TimeSpan CalcDataAge     = DateTimeNow - SessionDateTime;
                int      TimeSpanDays    = CalcDataAge.Days;
                int      TimeSpanHours   = CalcDataAge.Hours;
                int      TimeSpanMinutes = CalcDataAge.Minutes;

                if (TimeSpanDays == 0)
                {
                    // Do nothing.
                }
                else if (TimeSpanDays == 1)
                {
                    TimeSpanDaysText = TimeSpanDays + " day, ";
                }
                else
                {
                    TimeSpanDaysText = TimeSpanDays + " days, ";
                }

                if (TimeSpanHours == 1)
                {
                    TimeSpanHoursText = TimeSpanHours + " hour, ";
                }
                else
                {
                    TimeSpanHoursText = TimeSpanHours + " hours, ";
                }

                if (TimeSpanMinutes == 1)
                {
                    TimeSpanMinutesText = TimeSpanMinutes + " minute ago.";
                }
                else
                {
                    TimeSpanMinutesText = TimeSpanMinutes + " minutes ago.";
                }

                String DataAge = TimeSpanDaysText + TimeSpanHoursText + TimeSpanMinutesText;

                String DataCollected = SessionDateTime.ToString("dddd, MMMM dd, yyyy h:mm tt");

                ResultsString.AppendLine($"Session Captured: {DataCollected}");
                ResultsString.AppendLine($"Capture was {DataAge}");

                ResultsString.AppendLine($"Session Type: {this.session["X-SessionType"]}");
                ResultsString.AppendLine($"Process: {this.session["X-ProcessName"]}");


                if (this.session["X-HostIP"]?.ToString().Length > 0)
                {
                    ResultsString.AppendLine($"Host IP: {this.session["X-HostIP"]}");
                }

                // Response Server.
                if (this.session.isTunnel == true)
                {
                    ResultsString.AppendLine("Connect Tunnel");
                }
                else if ((this.session.oResponse["Server"] != null) && (this.session.oResponse["Server"] != ""))
                {
                    ResultsString.AppendLine($"Response Server: {this.session.oResponse["Server"]}");
                }
                // Else if the reponnse Host header is not null or blank then populate it into the response server value
                // Some traffic identifies a host rather than a response server.
                else if ((this.session.oResponse["Host"] != null && (this.session.oResponse["Host"] != "")))
                {
                    ResultsString.AppendLine($"Host: {this.session.oResponse["Host"]}");
                }
                // Else if the response PoweredBy header is not null or blank then populate it into the response server value.
                // Some Office 365 servers respond as X-Powered-By ASP.NET.
                else if ((this.session.oResponse["X-Powered-By"] != null) && (this.session.oResponse["X-Powered-By"] != ""))
                {
                    ResultsString.AppendLine($"X-Powered-By: {this.session.oResponse["X-Powered-By"]}");
                }
                // Else if the response X-Served-By header is not null or blank then populate it into the response server value.
                else if ((this.session.oResponse["X-Served-By"] != null && (this.session.oResponse["X-Served-By"] != "")))
                {
                    ResultsString.AppendLine($"X-Served-By: {this.session.oResponse["X-Served-By"]}");
                }
                // Else if the response X-Served-By header is not null or blank then populate it into the response server value.
                else if ((this.session.oResponse["X-Server-Name"] != null && (this.session.oResponse["X-Server-Name"] != "")))
                {
                    ResultsString.AppendLine($"X-Server-Name: {this.session.oResponse["X-Server-Name"]}");
                }

                ResultsString.AppendLine();

                /// <remarks>
                /// Client Begin and done response. -- Overall elapsed time.
                /// </remarks>
                ResultsString.AppendLine("Overall Session Timers");
                ResultsString.AppendLine("----------------------");
                ResultsString.AppendLine();
                ResultsString.AppendLine("For an explantion of session timers refer to: https://aka.ms/Timers-Definitions");
                ResultsString.AppendLine();
                ResultsString.AppendLine($"Client Connected: {this.session.Timers.ClientConnected.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Client Begin Request: {this.session.Timers.ClientBeginRequest.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Got Request Headers: {this.session.Timers.FiddlerGotRequestHeaders.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Client Done Response: {this.session.Timers.ClientDoneResponse.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");

                // ClientDoneResponse can be blank. If so do not try to calculate and output Elapsed Time, we end up with a hideously large number.
                if (this.session.Timers.ClientDoneResponse.ToString("H:mm:ss.fff") != "0:00:00.000")
                {
                    double ClientMilliseconds = Math.Round((this.session.Timers.ClientDoneResponse - this.session.Timers.ClientBeginRequest).TotalMilliseconds);

                    ResultsString.AppendLine();
                    ResultsString.AppendLine($"Elapsed Time: {ClientMilliseconds}ms");

                    if (ClientMilliseconds > 1000)
                    {
                        double ClientSeconds = Math.Round((this.session.Timers.ClientDoneResponse - this.session.Timers.ClientBeginRequest).TotalSeconds);
                        ResultsString.AppendLine($"Elapsed Time: {ClientSeconds}s");
                    }

                    int SlowRunningSessionThreshold = Preferences.GetSlowRunningSessionThreshold();

                    if (ClientMilliseconds > SlowRunningSessionThreshold)
                    {
                        ResultsString.AppendLine("!Long running session!");
                        if (Preferences.AppLoggingEnabled)
                        {
                            FiddlerApplication.Log.LogString("EXOFiddlerExtention: " + this.session.id + " Long running session.");
                        }
                    }
                    ResultsString.AppendLine();
                }
                else
                {
                    ResultsString.AppendLine();
                    ResultsString.AppendLine("Session does not contain data to calculate 'Elapsed Time'.");
                }

                /// <remarks>
                /// Server Got and Done Response. -- Server Think Time.
                /// </remarks>
                ///
                ResultsString.AppendLine();
                ResultsString.AppendLine("Server Timers");
                ResultsString.AppendLine("-------------");
                ResultsString.AppendLine();
                // Write Server data into textboxes.
                ResultsString.AppendLine($"Fiddler Begin Request: { this.session.Timers.FiddlerBeginRequest.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Server Got Request: { this.session.Timers.ServerGotRequest.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Server Begin Response: { this.session.Timers.ServerBeginResponse.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Got Response Headers: { this.session.Timers.FiddlerGotResponseHeaders.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");
                ResultsString.AppendLine($"Server Done Response: {this.session.Timers.ServerDoneResponse.ToString("yyyy/MM/dd H:mm:ss.fff tt")}");

                // ServerGotRequest, ServerBeginResponse or ServerDoneResponse can be blank. If so do not try to calculate and output 'Server Think Time' or 'Transmit Time', we end up with a hideously large number.
                if (this.session.Timers.ServerGotRequest.ToString("H:mm:ss.fff") != "0:00:00.000" &&
                    this.session.Timers.ServerBeginResponse.ToString("H:mm:ss.fff") != "0:00:00.000" &&
                    this.session.Timers.ServerDoneResponse.ToString("H:mm:ss.fff") != "0:00:00.000")
                {
                    double ServerMilliseconds = Math.Round((this.session.Timers.ServerBeginResponse - this.session.Timers.ServerGotRequest).TotalMilliseconds);

                    ResultsString.AppendLine();
                    ResultsString.AppendLine($"Server Think Time: {ServerMilliseconds}ms");

                    if (ServerMilliseconds > 1000)
                    {
                        double ServerSeconds = Math.Round((this.session.Timers.ServerBeginResponse - this.session.Timers.ServerGotRequest).TotalSeconds);
                        ResultsString.AppendLine($"Server Think Time: {ServerSeconds}s");
                    }

                    int SlowRunningSessionThreshold = Preferences.GetSlowRunningSessionThreshold();

                    if (ServerMilliseconds > SlowRunningSessionThreshold)
                    {
                        ResultsString.AppendLine("!Long running EXO session!");
                        if (Preferences.AppLoggingEnabled)
                        {
                            FiddlerApplication.Log.LogString("EXOFiddlerExtention: " + this.session.id + " Long running EXO session.");
                        }
                    }
                    ResultsString.AppendLine();
                    ResultsString.AppendLine($"Transit Time: { Math.Round((this.session.Timers.ServerDoneResponse - this.session.Timers.ServerBeginResponse).TotalMilliseconds)} ms");
                }
                else
                {
                    ResultsString.AppendLine();
                    ResultsString.AppendLine("Session does not contain data to calculate 'Server Think Time' and 'Transit Time'.");
                }

                // Authentication
                if (this.session["X-AUTHENTICATION"] != "No Auth Headers")
                {
                    ResultsString.AppendLine();
                    ResultsString.AppendLine("Authentication");
                    ResultsString.AppendLine("--------------");
                    ResultsString.AppendLine();
                    ResultsString.AppendLine($"Authentication Type: {this.session["X-AUTHENTICATION"]}");
                    ResultsString.AppendLine();
                    ResultsString.AppendLine($"Authentication Description: {this.session["X-AUTHENTICATIONDESC"]}");
                }

                if (this.session["X-Office365AuthType"] == "SAMLResponseParser")
                {
                    ResultsString.AppendLine($"Issuer: {this.session["X-ISSUER"]}");
                    ResultsString.AppendLine($"Attribute Name Immutable Id: {this.session["X-ATTRIBUTENAMEIMMUTABLEID"]}");
                    ResultsString.AppendLine($"Attribute Name UPN: {this.session["X-ATTRIBUTENAMEUPN"]}");
                    ResultsString.AppendLine($"Name Identifier Format: {this.session["X-NAMEIDENTIFIERFORMAT"]}");
                    ResultsString.AppendLine("Signing Certificate: Copy and save the below text into a .cer file to view the certificate.");
                    ResultsString.AppendLine("");
                    ResultsString.AppendLine("-----BEGIN CERTIFICATE-----");
                    ResultsString.AppendLine(this.session["X-SigningCertificate"]);
                    ResultsString.AppendLine("-----END CERTIFICATE-----");
                }

                ResultsString.AppendLine();
                ResultsString.AppendLine("Session Analysis");
                ResultsString.AppendLine("----------------");
                ResultsString.AppendLine();
                ResultsString.AppendLine($"Session Alert: {this.session["X-ResponseAlert"]}");
                ResultsString.AppendLine();
                ResultsString.AppendLine($"Session Comment: {this.session["X-ResponseComments"]}");
                ResultsString.AppendLine();

                ExchangeResponseControl.ResultsOutput.AppendText(ResultsString.ToString());
            }
            catch (Exception ex)
            {
                ResultsString.AppendLine();
                ResultsString.AppendLine(ex.Message);
                ResultsString.AppendLine();
                ExchangeResponseControl.ResultsOutput.AppendText(ResultsString.ToString());
            }
        }