//return the score by data
 //server with highest score will be choosen
 private float GetScore(string serverName)
 {
     var config = _controller.StatisticsConfiguration;
     List<AvailabilityStatistics.RawStatisticsData> dataList;
     if (_filteredStatistics == null || !_filteredStatistics.TryGetValue(serverName, out dataList)) return 0;
     var successTimes = (float) dataList.Count(data => data.ICMPStatus.Equals(IPStatus.Success.ToString()));
     var timedOutTimes = (float) dataList.Count(data => data.ICMPStatus.Equals(IPStatus.TimedOut.ToString()));
     var statisticsData = new AvailabilityStatistics.StatisticsData
     {
         PackageLoss = timedOutTimes/(successTimes + timedOutTimes)*100,
         AverageResponse = Convert.ToInt32(dataList.Average(data => data.RoundtripTime)),
         MinResponse = dataList.Min(data => data.RoundtripTime),
         MaxResponse = dataList.Max(data => data.RoundtripTime)
     };
     float factor;
     float score = 0;
     if (!config.Calculations.TryGetValue("PackageLoss", out factor)) factor = 0;
     score += statisticsData.PackageLoss*factor;
     if (!config.Calculations.TryGetValue("AverageResponse", out factor)) factor = 0;
     score += statisticsData.AverageResponse*factor;
     if (!config.Calculations.TryGetValue("MinResponse", out factor)) factor = 0;
     score += statisticsData.MinResponse*factor;
     if (!config.Calculations.TryGetValue("MaxResponse", out factor)) factor = 0;
     score += statisticsData.MaxResponse*factor;
     Logging.Debug($"{serverName}  {JsonConvert.SerializeObject(statisticsData)}");
     return score;
 }
        //return the score by data
        //server with highest score will be choosen
        private float GetScore(string serverName)
        {
            var config = _controller.StatisticsConfiguration;
            List <AvailabilityStatistics.RawStatisticsData> dataList;

            if (_filteredStatistics == null || !_filteredStatistics.TryGetValue(serverName, out dataList))
            {
                return(0);
            }
            var successTimes   = (float)dataList.Count(data => data.ICMPStatus.Equals(IPStatus.Success.ToString()));
            var timedOutTimes  = (float)dataList.Count(data => data.ICMPStatus.Equals(IPStatus.TimedOut.ToString()));
            var statisticsData = new AvailabilityStatistics.StatisticsData
            {
                PackageLoss     = timedOutTimes / (successTimes + timedOutTimes) * 100,
                AverageResponse = Convert.ToInt32(dataList.Average(data => data.RoundtripTime)),
                MinResponse     = dataList.Min(data => data.RoundtripTime),
                MaxResponse     = dataList.Max(data => data.RoundtripTime)
            };
            float factor;
            float score = 0;

            if (!config.Calculations.TryGetValue("PackageLoss", out factor))
            {
                factor = 0;
            }
            score += statisticsData.PackageLoss * factor;
            if (!config.Calculations.TryGetValue("AverageResponse", out factor))
            {
                factor = 0;
            }
            score += statisticsData.AverageResponse * factor;
            if (!config.Calculations.TryGetValue("MinResponse", out factor))
            {
                factor = 0;
            }
            score += statisticsData.MinResponse * factor;
            if (!config.Calculations.TryGetValue("MaxResponse", out factor))
            {
                factor = 0;
            }
            score += statisticsData.MaxResponse * factor;
            Logging.Debug($"{serverName}  {SimpleJson.SimpleJson.SerializeObject(statisticsData)}");
            return(score);
        }