Example #1
0
 /// <summary>
 /// Configure a IP configuration on the given network device.
 /// <remarks>Multiple IP Configurations can be made, like *nix environments</remarks>
 /// </summary>
 /// <param name="nic"><see cref="NetworkDevice"/> that will have the assigned configuration</param>
 /// <param name="config"><see cref="IPV4.Config"/> instance that defines the IP Address, Subnet
 /// Mask and Default Gateway for the device</param>
 public static void ConfigIP(NetworkDevice nic, IPV4.Config config)
 {
     if (NetworkConfig.ContainsKey(nic))
     {
         Console.WriteLine("Config Exists!");
         IPV4.Config toremove = NetworkConfig.Get(nic);
         AddressMap.Remove(toremove.IPAddress.Hash);
         MACMap.Remove(nic.MACAddress.Hash);
         IPV4.Config.Remove(config);
         NetworkConfig.Remove(nic);
         SetConfigIP(nic, config);
     }
     else
     {
         SetConfigIP(nic, config);
     }
 }