Update the actiondebug.

This commit is contained in:
Tim Young 2018-10-05 10:51:22 -05:00
parent b4e828162a
commit 0cdb4855ad

View File

@ -204,7 +204,7 @@ namespace EduNetworkBuilder
myNet.MarkAsLinked(sourceNL.Dst, sourceNL.GetUniqueIdentifier); myNet.MarkAsLinked(sourceNL.Dst, sourceNL.GetUniqueIdentifier);
myNet.AddItem(ChangedComponent); myNet.AddItem(ChangedComponent);
} }
if(NB.DebugActions) { Console.WriteLine("Changing a component: " + source); } if(NB.DebugActions) { Console.WriteLine("Changing a component: " + source.hostname); }
break; break;
case NBAction.changelocation: case NBAction.changelocation:
if (source != null) if (source != null)
@ -227,7 +227,7 @@ namespace EduNetworkBuilder
myNet.RemoveLinksToNic(nicID); myNet.RemoveLinksToNic(nicID);
} }
myNet.RemoveComponent(source); myNet.RemoveComponent(source);
if (NB.DebugActions) { Console.WriteLine("Deleting a device: " + source); } if (NB.DebugActions) { Console.WriteLine("Deleting a device: " + source.hostname); }
} else if(sourceC != null && sourceC is NetworkLink) } else if(sourceC != null && sourceC is NetworkLink)
{ {
if (myNet.ItemIsCritical(sourceC.hostname)) if (myNet.ItemIsCritical(sourceC.hostname))
@ -235,7 +235,7 @@ namespace EduNetworkBuilder
NetworkLink SourceL = (NetworkLink)sourceC; NetworkLink SourceL = (NetworkLink)sourceC;
SourceL.Destroy(); //Mark both ends as being deleted SourceL.Destroy(); //Mark both ends as being deleted
myNet.RemoveComponent(SourceL); //Get rid of this link myNet.RemoveComponent(SourceL); //Get rid of this link
if (NB.DebugActions) { Console.WriteLine("Deleting a link: " + source); } if (NB.DebugActions) { Console.WriteLine("Deleting a link: " + source.hostname); }
} }
break; break;
case NBAction.newdevice: case NBAction.newdevice:
@ -255,47 +255,47 @@ namespace EduNetworkBuilder
if (CanDo) if (CanDo)
{ {
ChangedComponent = (NetworkDevice)myNet.AddItem(newItemType, Location); ChangedComponent = (NetworkDevice)myNet.AddItem(newItemType, Location);
if (NB.DebugActions) { Console.WriteLine("Adding a Device: " + source); } if (NB.DebugActions) { Console.WriteLine("Adding a Device: " + source.hostname); }
} }
else else
{ {
NB.SetBuilderWindowStatis(NB.Translate("NB_TreePlacementError")); NB.SetBuilderWindowStatis(NB.Translate("NB_TreePlacementError"));
if (NB.DebugActions) { Console.WriteLine("Unable to add device: " + source); } if (NB.DebugActions) { Console.WriteLine("Unable to add device: " + source.hostname); }
} }
break; break;
case NBAction.dhcp: case NBAction.dhcp:
if (source != null) if (source != null)
{ {
source.DHCPRequestFromHere(); source.DHCPRequestFromHere();
if (NB.DebugActions) { Console.WriteLine("Requesting DHCP: " + source); } if (NB.DebugActions) { Console.WriteLine("Requesting DHCP: " + source.hostname); }
} }
break; break;
case NBAction.arp: case NBAction.arp:
if (source != null) if (source != null)
{ {
source.AskArpFromHere(Destination); source.AskArpFromHere(Destination);
if (NB.DebugActions) { Console.WriteLine("Requesting DHCP: " + source); } if (NB.DebugActions) { Console.WriteLine("Requesting DHCP: " + source.hostname); }
} }
break; break;
case NBAction.cleararp: case NBAction.cleararp:
if (source != null) if (source != null)
{ {
source.ClearArps(); source.ClearArps();
if (NB.DebugActions) { Console.WriteLine("Clearing ARP: " + source); } if (NB.DebugActions) { Console.WriteLine("Clearing ARP: " + source.hostname); }
} }
break; break;
case NBAction.ping: case NBAction.ping:
if (source != null) if (source != null)
{ {
source.PingFromHere(Destination); source.PingFromHere(Destination);
if (NB.DebugActions) { Console.WriteLine("Pinging " + Destination + " from " + source); } if (NB.DebugActions) { Console.WriteLine("Pinging " + Destination.GetIPString + " from " + source.hostname); }
} }
break; break;
case NBAction.traceroute: case NBAction.traceroute:
if (source != null) if (source != null)
{ {
source.TracerouteFromHere(Destination); source.TracerouteFromHere(Destination);
if (NB.DebugActions) { Console.WriteLine("Traceroute: " + Destination+ " from " + source); } if (NB.DebugActions) { Console.WriteLine("Traceroute: " + Destination.GetIPString + " from " + source.hostname); }
} }
break; break;
case NBAction.replace: case NBAction.replace:
@ -309,7 +309,7 @@ namespace EduNetworkBuilder
myNet.RegisterDeviceReset(source.hostname); //replacing something powers it off myNet.RegisterDeviceReset(source.hostname); //replacing something powers it off
myNet.RegisterDeviceReplaced(source.hostname); //replace it. myNet.RegisterDeviceReplaced(source.hostname); //replace it.
if (NB.DebugActions) { Console.WriteLine("Replacing device: " + source); } if (NB.DebugActions) { Console.WriteLine("Replacing device: " + source.hostname); }
} }
else if (sourceC is NetworkLink) else if (sourceC is NetworkLink)
{ {
@ -322,22 +322,22 @@ namespace EduNetworkBuilder
myNet.RemoveComponent(sourceNL); myNet.RemoveComponent(sourceNL);
NetworkLink nNL = new NetworkLink(sourceID, destID, LinkType.normal); NetworkLink nNL = new NetworkLink(sourceID, destID, LinkType.normal);
myNet.AddItem(nNL); myNet.AddItem(nNL);
if (NB.DebugActions) { Console.WriteLine("Replacing link: " + source); } if (NB.DebugActions) { Console.WriteLine("Replacing link: " + source.hostname); }
} }
} }
break; break;
case NBAction.replaceUPS: case NBAction.replaceUPS:
myNet.RegisterUPSAdded(source.hostname); myNet.RegisterUPSAdded(source.hostname);
if (NB.DebugActions) { Console.WriteLine("Replacing UPS on: " + source); } if (NB.DebugActions) { Console.WriteLine("Replacing UPS on: " + source.hostname); }
break; break;
case NBAction.poweroff: case NBAction.poweroff:
source.PowerOff = true; source.PowerOff = true;
myNet.RegisterDeviceReset(source.hostname); myNet.RegisterDeviceReset(source.hostname);
if (NB.DebugActions) { Console.WriteLine("Powering off: " + source); } if (NB.DebugActions) { Console.WriteLine("Powering off: " + source.hostname); }
break; break;
case NBAction.poweron: case NBAction.poweron:
source.PowerOff = false; source.PowerOff = false;
if (NB.DebugActions) { Console.WriteLine("Powering on: " + source); } if (NB.DebugActions) { Console.WriteLine("Powering on: " + source.hostname); }
//We might see about exploding the device here. //We might see about exploding the device here.
break; break;
} }