public void visitCSF_metricHighDownload(CSF_metricHighDownload 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       downloadSize = 0;
            foreach (DictionaryEntry pair in table)
            {
                downloadSize += (int)pair.Value;
            }
            double metricValue = percentage(minimumHighDownload, maximumHighDownload, downloadSize);
            if (metricValue > 0)
            {
                if (DEBUG.METRIC)
                {
                    System.Console.WriteLine(ip + " download " + downloadSize + ", triggered when more than " + minimumHighDownload + " MB of data uploaded");
                }
                this.addEntry(ip, metric.Metric, metricValue);
            }
        }
    }
Ejemplo n.º 2
0
        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;

        }
Ejemplo n.º 3
0
 public bool visitWithBoolCSF_metricHighDownload(CSF_metricHighDownload metric)
 {
     if (this.sameType(metric))
     {
         this.mergeHighDownload(metric); return(true);
     }
     else
     {
         return(false);
     }
 }
 public bool visitWithBoolCSF_metricHighDownload(CSF_metricHighDownload metric)
 {
     throw new Exception("Merging does not do bool visit");
 }
Ejemplo n.º 5
0
 public void visitCSF_metricHighDownload(CSF_metricHighDownload metric)
 {
     throw new Exception("Merging does not do void visit");
 }