public void visitCSF_metricLocalPeerDiscovery(CSF_metricLocalPeerDiscovery metric)
    {
        if (DEBUG.METRIC)
        {
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            System.Console.WriteLine("\r\n" + metric.Metric);
            Console.ResetColor();
        }
        Dictionary <string, int> sinnerList = metric.Sinners;

        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, int> sourceEntry in sinnerList)
        {
            double metricValue = percentage(minimumLocalPeerDiscovery, maximumLocalPeerDiscovery, sourceEntry.Value);
            if (metricValue > 0)
            {
                if (DEBUG.METRIC)
                {
                    System.Console.WriteLine(sourceEntry.Key + " done local peer discovery " + sourceEntry.Value + " times");
                }
                this.addEntry(sourceEntry.Key, metric.Metric, metricValue);
            }
        }
    }
Example #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;

        }
Example #3
0
 public bool visitWithBoolCSF_metricLocalPeerDiscovery(CSF_metricLocalPeerDiscovery metric)
 {
     if (this.sameType(metric))
     {
         this.mergeLocalPeerDiscovery(metric); return(true);
     }
     else
     {
         return(false);
     }
 }
 public bool visitWithBoolCSF_metricLocalPeerDiscovery(CSF_metricLocalPeerDiscovery metric)
 {
     throw new Exception("Merging does not do bool visit");
 }
Example #5
0
 public void visitCSF_metricLocalPeerDiscovery(CSF_metricLocalPeerDiscovery metric)
 {
     throw new Exception("Merging does not do void visit");
 }