Interfaces Equals operator and updating the networkCard equals operator to use the interfaces operator.

This commit is contained in:
Tim Young 2018-03-16 14:35:12 -05:00
parent 485a57382b
commit 990920b48f
2 changed files with 14 additions and 0 deletions

View File

@ -103,6 +103,9 @@ namespace EduNetworkBuilder
if (MAC != compareWith.MAC) return false; if (MAC != compareWith.MAC) return false;
//List<NetworkInterface> interfaces = new List<NetworkInterface>(); //List<NetworkInterface> interfaces = new List<NetworkInterface>();
if (interfaces.Count != compareWith.interfaces.Count) return false;
for (int i = 0; i < interfaces.Count; i++)
if (!interfaces[i].Equals(compareWith.interfaces[i])) return false;
if (UsesDHCP != compareWith.UsesDHCP) return false; if (UsesDHCP != compareWith.UsesDHCP) return false;
if (CanUseDHCP != compareWith.CanUseDHCP) return false; if (CanUseDHCP != compareWith.CanUseDHCP) return false;
if (MustUseDHCP != compareWith.MustUseDHCP) return false; if (MustUseDHCP != compareWith.MustUseDHCP) return false;

View File

@ -66,6 +66,17 @@ namespace EduNetworkBuilder
return null; return null;
} }
public bool Equals(NetworkInterface CompareWith)
{
if (!myIP.Equals(CompareWith.myIP)) return false;
if (nic_name != CompareWith.nic_name) return false;
if (!AttachedToHostNic.Equals(CompareWith.AttachedToHostNic)) return false;
if (VLANs.Count != CompareWith.VLANs.Count) return false;
for (int i = 0; i < VLANs.Count; i++)
if (!VLANs[i].Equals(CompareWith.VLANs[i])) return false;
return true;
}
public VLANTagType GetVLANTag(int id) public VLANTagType GetVLANTag(int id)
{ {
VLANInfo vli = GetVLANInfo(id); VLANInfo vli = GetVLANInfo(id);