internal void AddMessage(Request Req) { WebSocketSession WS = GetSession(Req); WS.AddRequest(Req); }
internal void AddMessage(Request Req, Response Res) { WebSocketSession WS = GetSession(Req); WS.AddResponse(Req, Res); }
void DoAnalysis() { WebSocketSessions Sessions = new WebSocketSessions(); try { File.WriteAllText(string.Format("{0}\\style.css", OutputDir.FullName), Css); int LogId = 1; while (LogId <= Config.GetLastLogId("WebSocket")) { try { Session Sess = Session.FromLog(LogId, "WebSocket"); if (Sess.Response == null) { Sessions.AddMessage(Sess.Request); } else { Sessions.AddMessage(Sess.Request, Sess.Response); } } catch (Exception Exp) { IronException.Report("Could not load WebSocket Message in to Message Extractor", Exp); //This could happen when the most recent messages have not yet been written to the DB by the LogCount has been incremented } LogId++; } StringBuilder IndexPage = new StringBuilder(IndexPageTop); int SessionCount = 0; foreach (string SessionId in Sessions.SessionIdsList) { WebSocketSession WS = Sessions.GetSession(SessionId); SessionCount++; IndexPage.AppendLine("<li>"); IndexPage.AppendLine(string.Format("<a href='{0}.html'>{1}</a>", SessionCount, WS.Url)); IndexPage.AppendLine("<table cellpadding='1' cellspacing='1'>"); IndexPage.AppendLine(string.Format("<tr><td><span class='stat_name_mts'>Messages to Server: </span><span class='stat_value'>{0}</span></td></tr>", WS.Requests.Count)); IndexPage.AppendLine(string.Format("<tr><td><span class='stat_name_mtc'>Messages to Client: </span><span class='stat_value'>{0}</span></td></tr>", WS.Responses.Count)); IndexPage.AppendLine("</table>"); IndexPage.AppendLine("</li>"); AnalyzeSession(WS, SessionCount); } IndexPage.AppendLine(IndexPageBottom); File.WriteAllText(string.Format("{0}\\index.html", OutputDir.FullName), IndexPage.ToString()); ShowStatusMsg("Open the below file in browser to view the analysis results"); ShowOutputFile(string.Format("{0}\\index.html", OutputDir.FullName)); } catch (ThreadAbortException) { } catch (Exception Exp) { IronException.Report("Error in WebSocket Message Analyzer", Exp); ShowStatusMsg("Error!! Check the exceptions area for error details."); } ShowAnalysisEndInUi(); }