From a45807cb2de2b87c579bb690e72c791f3b257cb3 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Fri, 16 Feb 2018 12:15:04 +0000 Subject: [PATCH] Items which are burned or frozen cannot do some things. --- EduNetworkBuilder/Network.cs | 2 +- EduNetworkBuilder/NetworkBuilder.cs | 10 +++++----- EduNetworkBuilder/NetworkDevice.cs | 13 +++++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 0a4a7ca..3f3d32c 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1730,7 +1730,6 @@ namespace EduNetworkBuilder } } - public void RegisterDeviceReplaced(string source) { foreach (NetTest one in NetTests) @@ -1753,6 +1752,7 @@ namespace EduNetworkBuilder if(NB.GetComponentType(nc) == GeneralComponentType.device) { nd = (NetworkDevice)nc; + if (nd.IsBurned || nd.isFrozen() || nd.PowerOff) continue; //skip if burnt, off or frozen nd.DHCPRequestFromHere(); } } diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 2cd712c..dbaed56 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -786,7 +786,7 @@ namespace EduNetworkBuilder if (ReleasedOn != null && ReleasedOn.IsNotNetDevice() && !ReleasedOn.IsBurned) { List DoneList = new List(); - if (!PoweredOff) + if (!PoweredOff && !ReleasedOn.isFrozen()) { foreach (string tStr in myNetwork.GetIncompleteTestDestinations(ReleasedOn.hostname, ContextTest.ping)) { @@ -824,7 +824,7 @@ namespace EduNetworkBuilder } } } - if (ReleasedOn != null && ReleasedOn.IsNotNetDevice() && !ReleasedOn.IsBurned) + if (ReleasedOn != null && ReleasedOn.IsNotNetDevice() && !ReleasedOn.IsBurned && !ReleasedOn.isFrozen()) { if (!PoweredOff) { @@ -838,7 +838,7 @@ namespace EduNetworkBuilder pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_ArpClear_Click; } } - if (ReleasedOn != null) + if (ReleasedOn != null && !ReleasedOn.isFrozen()) { if (!myNetwork.ItemIsCritical(ReleasedOn.hostname)) { @@ -846,7 +846,7 @@ namespace EduNetworkBuilder pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Delete_Click; } } - if (ReleasedOn != null && ReleasedOn.IsNotNetDevice() && !PoweredOff && !ReleasedOn.IsBurned) + if (ReleasedOn != null && ReleasedOn.IsNotNetDevice() && !PoweredOff && !ReleasedOn.IsBurned && !ReleasedOn.isFrozen()) { pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("_Edit")); pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Edit_Click; @@ -855,7 +855,7 @@ namespace EduNetworkBuilder if (ReleasedOn != null) { ItemClickedOn = ReleasedOn; - if (!PoweredOff && !ReleasedOn.IsBurned) + if (!PoweredOff && !ReleasedOn.IsBurned && !ReleasedOn.isFrozen()) { if (ReleasedOn.HasDHCPNic()) { diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 1108081..684ba69 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -327,6 +327,19 @@ namespace EduNetworkBuilder return myType; } + public bool isFrozen() + { + Network mynet = NB.GetNetwork(); + if (mynet.ItemHasTest(hostname, NetTestType.DeviceIsFrozen)) + { + if (!mynet.ItemTestIsComplete(hostname, NetTestType.DeviceIsFrozen)) + { + return true; + } + } + return false; + } + public override void Load(XmlNode theNode) { NetworkCard newNic;