internal static bool WriteStream(StreamWriter swOutput, Session[] oSessions, bool bUseV1dot2Format, EventHandler <ProgressCallbackEventArgs> evtProgressNotifications, int iMaxTextBodyLength, int iMaxBinaryBodyLength) { HTTPArchiveJSONExport._iMaxTextBodyLength = iMaxTextBodyLength; HTTPArchiveJSONExport._iMaxBinaryBodyLength = iMaxBinaryBodyLength; Hashtable hashtable = new Hashtable(); hashtable.Add("version", bUseV1dot2Format ? "1.2" : "1.1"); hashtable.Add("pages", new ArrayList(0)); if (bUseV1dot2Format) { hashtable.Add("comment", "exported @ " + DateTime.Now.ToString()); } Hashtable hashtable2 = new Hashtable(); hashtable2.Add("name", "Fiddler"); hashtable2.Add("version", Application.ProductVersion); if (bUseV1dot2Format) { hashtable2.Add("comment", "http://www.fiddler2.com"); } hashtable.Add("creator", hashtable2); ArrayList arrayList = new ArrayList(); int num = 0; int i = 0; while (i < oSessions.Length) { Session session = oSessions[i]; try { if (session.get_state() < 11) { goto IL_24D; } Hashtable hashtable3 = new Hashtable(); hashtable3.Add("startedDateTime", session.Timers.ClientBeginRequest.ToString("o")); hashtable3.Add("request", HTTPArchiveJSONExport.getRequest(session)); hashtable3.Add("response", HTTPArchiveJSONExport.getResponse(session, bUseV1dot2Format)); hashtable3.Add("cache", new Hashtable()); Hashtable timings = HTTPArchiveJSONExport.getTimings(session.Timers, bUseV1dot2Format); hashtable3.Add("time", HTTPArchiveJSONExport.getTotalTime(timings)); hashtable3.Add("timings", timings); if (bUseV1dot2Format) { string value = session.get_Item("ui-comments"); if (!string.IsNullOrEmpty(value)) { hashtable3.Add("comment", session.get_Item("ui-comments")); } string arg_1A9_0 = session.m_hostIP; if (!string.IsNullOrEmpty(value) && !session.isFlagSet(2048)) { hashtable3.Add("serverIPAddress", session.m_hostIP); } hashtable3.Add("connection", session.get_clientPort().ToString()); } arrayList.Add(hashtable3); } catch (Exception ex) { FiddlerApplication.ReportException(ex, "Failed to Export Session"); } goto IL_20B; IL_24D: i++; continue; IL_20B: num++; if (evtProgressNotifications == null) { goto IL_24D; } ProgressCallbackEventArgs progressCallbackEventArgs = new ProgressCallbackEventArgs((float)num / (float)oSessions.Length, "Wrote " + num.ToString() + " sessions to HTTPArchive."); evtProgressNotifications(null, progressCallbackEventArgs); if (progressCallbackEventArgs.get_Cancel()) { return(false); } goto IL_24D; } hashtable.Add("entries", arrayList); swOutput.WriteLine(JSON.JsonEncode(new Hashtable { { "log", hashtable } })); return(true); }