public void visitCSF_metricHighUpload(CSF_metricHighUpload metric) { if (DEBUG.METRIC) { Console.ForegroundColor = ConsoleColor.DarkMagenta; System.Console.WriteLine("\r\n" + metric.Metric); Console.ResetColor(); } Dictionary <string, Hashtable> connections = metric.RawValues; foreach (KeyValuePair <string, Hashtable> sourceEntry in connections) { string ip = sourceEntry.Key; Hashtable table = sourceEntry.Value; int uploadSize = 0; foreach (DictionaryEntry pair in table) { uploadSize += (int)pair.Value; } double metricValue = percentage(minimumHighUpload, maximumHighUpload, uploadSize); if (metricValue > 0) { if (DEBUG.METRIC) { System.Console.WriteLine(ip + " uploaded " + uploadSize + ", triggered when more than " + minimumHighUpload + " MB of data uploaded : value " + metricValue); } this.addEntry(ip, metric.Metric, metricValue); } } }
private CSF_metric correctMetric(CSF_metric metric) { string strMetric = metric.Metric; CSF_metric toReturn = metric; switch (strMetric) { case "CSF_HighDataDiffPeers" : toReturn = new CSF_metricHighDataDiffPeers(strMetric, metric.RawValues); break; case "CSF_ProtocolUPnP": toReturn = new CSF_metricProtocolUPnP(strMetric, metric.Sinners); break; case "CSF_LocalPeerDiscovery": toReturn = new CSF_metricLocalPeerDiscovery(strMetric, metric.Sinners); break; case "CSF_KnownTrackers": toReturn = new CSF_metricKnownTrackers(strMetric, metric.RawValues); break; case "CSF_IpInName": toReturn = new CSF_metricIpInName(strMetric, metric.RawValues); break; case "CSF_HighUpload": toReturn = new CSF_metricHighUpload(strMetric, metric.RawValues); break; case "CSF_HighDownload": toReturn = new CSF_metricHighDownload(strMetric, metric.RawValues); break; default: System.Console.WriteLine("\n\nNOT FOUND!!!\n\n" + strMetric + "\n\n"); break; } return toReturn; }
public bool visitWithBoolCSF_metricHighUpload(CSF_metricHighUpload metric) { if (this.sameType(metric)) { this.mergeHighUpload(metric); return(true); } else { return(false); } }
public bool visitWithBoolCSF_metricHighUpload(CSF_metricHighUpload metric) { throw new Exception("Merging does not do bool visit"); }
public void visitCSF_metricHighUpload(CSF_metricHighUpload metric) { throw new Exception("Merging does not do void visit"); }