Fix bug with replays and VLANs
This commit is contained in:
parent
811339b176
commit
b74f9932bb
@ -924,6 +924,14 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAllNicsVLANInfoAfterClone()
|
||||
{
|
||||
foreach (NetworkInterface nf in interfaces)
|
||||
{
|
||||
nf.UpdateVLANsAfterClone();
|
||||
}
|
||||
}
|
||||
|
||||
public void LockUsOutOfCard()
|
||||
{
|
||||
foreach (NetworkInterface nf in interfaces)
|
||||
|
@ -1535,6 +1535,7 @@ namespace EduNetworkBuilder
|
||||
NICs.Clear();
|
||||
foreach(NetworkCard nic in ndCopyFrom.NICs)
|
||||
{
|
||||
nic.UpdateAllNicsVLANInfoAfterClone();
|
||||
NICs.Add(NetworkCard.Clone(nic));
|
||||
}
|
||||
|
||||
|
@ -69,14 +69,40 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When we are doing replays and we load in a network interface using reflection,
|
||||
/// it can create a duplicate VLAN tag (1,untagged). Rebuilding these fixes that.
|
||||
/// </summary>
|
||||
public void UpdateVLANsAfterClone()
|
||||
{
|
||||
List<VLANInfo> tmpVLANs = new List<VLANInfo>();
|
||||
tmpVLANs.AddRange(VLANs);
|
||||
VLANs.Clear();
|
||||
foreach(VLANInfo VLI in tmpVLANs)
|
||||
{
|
||||
bool found = false;
|
||||
foreach(VLANInfo VLI2 in VLANs)
|
||||
{
|
||||
if(VLI2.ID == VLI.ID)
|
||||
{
|
||||
VLI2.Tag = VLI.Tag;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
VLANs.Add(VLI);
|
||||
}
|
||||
}
|
||||
|
||||
public VLANInfo GetVLANInfo(int id)
|
||||
{
|
||||
VLANInfo status = null;
|
||||
foreach(VLANInfo one in VLANs)
|
||||
{
|
||||
if (one.ID == id)
|
||||
return one;
|
||||
status = one;
|
||||
}
|
||||
return null;
|
||||
return status;
|
||||
}
|
||||
|
||||
public bool Equals(NetworkInterface CompareWith)
|
||||
|
Loading…
Reference in New Issue
Block a user