List what a port is connected to

This commit is contained in:
Tim Young 2016-10-06 09:17:27 -05:00
parent 99d7cdfa85
commit e4c9a38404
1 changed files with 19 additions and 0 deletions

View File

@ -173,7 +173,12 @@ namespace EduNetworkBuilder
string connected = " ";
if (isConnected(true)) connected = "*";
if (myNicType == NicType.port || myNicType == NicType.wport)
{
NetworkDevice ND = ConnectedTo();
if(ND != null)
return NicName() + connected + " -> " + ND.hostname;
return NicName() + connected;
}
return NicName() + connected + " " + MAC;
}
@ -289,6 +294,20 @@ namespace EduNetworkBuilder
return false;
}
public NetworkDevice ConnectedTo()
{
if (ConnectedLink != -1)
{
Network myNet = NB.GetNetwork();
NetworkLink NL = myNet.GetLinkFromID(ConnectedLink);
if (NL != null)
{
if (NL.IsSource(myID.HostID)) return myNet.GetDeviceFromID(NL.Dst);
else return myNet.GetDeviceFromID(NL.Src);
}
}
return null;
}
public void Edit()
{
NetworkCardEditor nce = new NetworkCardEditor(this);