public void visitCSF_metricKnownTrackers(CSF_metricKnownTrackers metric)
    {
        if (DEBUG.METRIC)
        {
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            System.Console.WriteLine("\r\n" + metric.Metric);
            Console.ResetColor();
        }

        Dictionary <string, Hashtable> sinnerList = metric.RawValues;

        if (sinnerList == null)
        {
            System.Console.WriteLine("null");
        }

        //We do register if a connection happens only once or more often, but we ignore that..
        foreach (KeyValuePair <string, Hashtable> sourceEntry in sinnerList)
        {
            double metricValue = percentage(minimumTrackers, maximumTrackers, sourceEntry.Value.Count);
            if (metricValue > 0)
            {
                if (DEBUG.METRIC)
                {
                    System.Console.WriteLine(sourceEntry.Key + " talked to " + sourceEntry.Value.Count + " trackers");
                }
                this.addEntry(sourceEntry.Key, metric.Metric, metricValue);
            }
        }
    }
示例#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;

        }
示例#3
0
 public bool visitWithBoolCSF_metricKnownTrackers(CSF_metricKnownTrackers metric)
 {
     if (this.sameType(metric))
     {
         this.mergeKnownTrackers(metric); return(true);
     }
     else
     {
         return(false);
     }
 }
 public bool visitWithBoolCSF_metricKnownTrackers(CSF_metricKnownTrackers metric)
 {
     throw new Exception("Merging does not do bool visit");
 }
示例#5
0
 public void visitCSF_metricKnownTrackers(CSF_metricKnownTrackers metric)
 {
     throw new Exception("Merging does not do void visit");
 }