/// <summary> /// Create protocol monitoring report /// </summary> /// <param name="level">The verbosity level.</param> /// <returns> /// string representation of report /// </returns> public string GetMonitoringStats(SMLoggerState level) { string result = string.Empty; // if we have zero saved result slots - just make totals if (this.savedStats.Count == 0) { // if HTTP log is avaialble, assume it is the last download operation if (this.LastHTTPLog != null) { return(this.LastHTTPLog.ToString()); } else { // output S+M operation if (level < SMLoggerState.VerboseLogging) { return(this.totals.GetShortLog()); } else { return(this.totals.ToString()); } } } // if we have saved slots, we make new side-by-side format int maxLines = 0; foreach (KeyValuePair <int, StatisticsSnapshot> kvp in this.savedStats) { StatisticsSnapshot ss = kvp.Value; if (maxLines < ss.MaxTotalsLines) { maxLines = ss.MaxTotalsLines; } ss.StartSxSOutput(); result += string.Format("{0,-40} ", ss.GetLogTitle()); } result += "\r\n"; for (int i = 0; i < maxLines; i++) { foreach (KeyValuePair <int, StatisticsSnapshot> kvp in this.savedStats) { StatisticsSnapshot ss = kvp.Value; result += string.Format("{0,-35} ", ss.GetSxSLine()); } result += "\r\n"; } return(result); }
/// <summary> /// Create protocol monitoring report /// </summary> /// <param name="level">The verbosity level.</param> /// <returns> /// string representation of report /// </returns> public string GetMonitoringStats(SMLoggerState level) { string result = string.Empty; // if we have zero saved result slots - just make totals if (this.savedStats.Count == 0) { // if HTTP log is avaialble, assume it is the last download operation if (this.LastHTTPLog != null) { return this.LastHTTPLog.ToString(); } else { // output S+M operation if (level < SMLoggerState.VerboseLogging) { return this.totals.GetShortLog(); } else { return this.totals.ToString(); } } } // if we have saved slots, we make new side-by-side format int maxLines = 0; foreach (KeyValuePair<int, StatisticsSnapshot> kvp in this.savedStats) { StatisticsSnapshot ss = kvp.Value; if (maxLines < ss.MaxTotalsLines) { maxLines = ss.MaxTotalsLines; } ss.StartSxSOutput(); result += string.Format("{0,-40} ", ss.GetLogTitle()); } result += "\r\n"; for (int i = 0; i < maxLines; i++) { foreach (KeyValuePair<int, StatisticsSnapshot> kvp in this.savedStats) { StatisticsSnapshot ss = kvp.Value; result += string.Format("{0,-35} ", ss.GetSxSLine()); } result += "\r\n"; } return result; }