From d128340987cc1cc01e1bc7e0469edb51938a9c11 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 13 Aug 2015 20:11:33 -0600 Subject: [PATCH] microwave and light logic for display --- EduNetworkBuilder/Network.cs | 2 ++ EduNetworkBuilder/NetworkDevice.cs | 31 ++++++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 523f3ed..0cdb7a3 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -953,6 +953,8 @@ namespace EduNetworkBuilder if(NB.GetComponentType(NC) == GeneralComponentType.device) { ND = (NetworkDevice)NC; + if (ND.GetNetType() == NetworkComponentType.microwave || ND.GetNetType() == NetworkComponentType.fluorescent) + continue; tList.Add(ND.hostname); } } diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 9de9c45..b9f7477 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -646,6 +646,8 @@ namespace EduNetworkBuilder List macStrings = new List(); int counter = 0; bool CanUse = true; + if (myType == NetworkComponentType.microwave || myType == NetworkComponentType.fluorescent) + return macStrings; foreach (NetworkCard nic in NICs) { if (OnlyUnused) @@ -668,7 +670,9 @@ namespace EduNetworkBuilder public List NetworkCardInterfaceStrings(int index) { List myList = new List(); - if(index >= 0 && index < NICs.Count) + if (myType == NetworkComponentType.microwave || myType == NetworkComponentType.fluorescent) + return myList; + if (index >= 0 && index < NICs.Count) { myList.AddRange(NICs[index].IPAddresses()); } @@ -772,20 +776,23 @@ namespace EduNetworkBuilder int counter = 0; CenterString(BaseImage, x, y + (counter * gap), hostname, Color.Black); counter++; - - foreach (NetworkCard nic in NICs) + if (myType != NetworkComponentType.microwave && myType != NetworkComponentType.fluorescent) { - if(nic.GetNicType != NicType.lo && nic.GetNicType != NicType.port && nic.GetNicType != NicType.wport) + foreach (NetworkCard nic in NICs) { - string title = ""; - if (nic.GetNicType == NicType.management_interface) - title += "if: "; - else - title += nic.NicName() + ": "; - foreach(string addr_str in nic.IPAddresses(true)) + if (nic.GetNicType != NicType.lo && nic.GetNicType != NicType.port && nic.GetNicType != NicType.wport) { - CenterString(BaseImage, x, y + (counter * gap), title + addr_str, Color.Black); - counter++; + string title = ""; + if (nic.GetNicType == NicType.management_interface) + title += "if: "; + else + title += nic.NicName() + ": "; + + foreach (string addr_str in nic.IPAddresses(true)) + { + CenterString(BaseImage, x, y + (counter * gap), title + addr_str, Color.Black); + counter++; + } } } }