Exemple #1
0
 /// <summary>
 /// This function increments the package-counter for a specific country.
 /// This function does NOT update the country or the map filling!
 /// </summary>
 /// <param name="IPAddress">The IP address string of the country</param>
 public static void addPackageToCountry(string IPAddress)
 {
     if (IPAddress != null)
     {
         uint   number  = IP2Country.address2Number(IPAddress);
         string country = IP2Country.number2Country(number).ToUpper();
         if (country != null)
         {
             if (_mapDictionary.ContainsKey(country))
             {
                 _mapDictionary[country] = _mapDictionary[country] + 1;
             }
             else
             {
                 _mapDictionary[country] = 1;
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// This function updates the data of the GUI (not the GUI itself), required when a new packet arrives here. Packet content can be accessed in e.UserState.
        /// </summary>
        /// <param name="e"></param>
        public void updateGUIData(ProgressChangedEventArgs e)
        {
            var packet = e.UserState as DataPacket;

            System.Net.IPAddress ip = packet.DestIP;

            if (ip != null)
            {
                // Add a packet to the country that is associated with the IP address
                WorldMap.addPackageToCountryUpdate(ip.ToString());
                ((GUIViewModel)this.DataContext).addPackage(packet.Length, packet.Protocol, IP2Country.number2Country(IP2Country.address2Number(ip.ToString())));
            }
        }