// update a profile public void UpdateProfile(IpProfile newProfile) { bool addProfile = true; foreach (IpProfile profile in profiles) { if (profile.GetGuid() == newProfile.GetGuid()) { addProfile = false; profile.SetProfileName(newProfile.GetProfileName()); profile.SetInterfaceName(newProfile.GetInterfaceName()); profile.SetDynamicIp(newProfile.GetDynamicIp()); profile.SetIpAddress(newProfile.GetIpAddress()); profile.SetSubnetMask(newProfile.GetSubnetMask()); profile.SetDefaultGateway(newProfile.GetDefaultGateway()); profile.SetDynamicDns(newProfile.GetDynamicDns()); profile.SetNameservers(newProfile.GetNameservers()); break; } } if (addProfile) { AddProfile(newProfile); } }
// remove a profile public void RemoveProfile(IpProfile profile) { for (int i = 0; i < profiles.Count; i++) { if (profiles[i].GetGuid() == profile.GetGuid()) { profiles.RemoveAt(i); break; } } }