do not duplicate "breaks." If we successfully break it one way, do not repeat it.
This commit is contained in:
parent
465de0f6b0
commit
36654e837f
@ -66,6 +66,7 @@ namespace EduNetworkBuilder
|
|||||||
private List<string> PacketColors = new List<string>();
|
private List<string> PacketColors = new List<string>();
|
||||||
private List<Image> PacketImages = new List<Image>();
|
private List<Image> PacketImages = new List<Image>();
|
||||||
private List<PingTestStatus> PingTestStats = new List<PingTestStatus>();
|
private List<PingTestStatus> PingTestStats = new List<PingTestStatus>();
|
||||||
|
private List<string> BrokenItems = new List<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WhatFrom: If we are launched from a homework, we remember it here.
|
/// WhatFrom: If we are launched from a homework, we remember it here.
|
||||||
@ -1936,6 +1937,9 @@ namespace EduNetworkBuilder
|
|||||||
int BreakNetComponent(NetworkComponent What, HowToBreak How, string Data)
|
int BreakNetComponent(NetworkComponent What, HowToBreak How, string Data)
|
||||||
{
|
{
|
||||||
int didit = 0;
|
int didit = 0;
|
||||||
|
if (What == null) return 0;
|
||||||
|
string WhatBreak = What.hostname + "-" + How.ToString() + "-" + Data;
|
||||||
|
if (BrokenItems.Contains(WhatBreak)) return 0; //it was already done
|
||||||
NetworkDevice tDevice = null;
|
NetworkDevice tDevice = null;
|
||||||
NetworkLink tLink = null;
|
NetworkLink tLink = null;
|
||||||
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
|
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
|
||||||
@ -1998,6 +2002,8 @@ namespace EduNetworkBuilder
|
|||||||
didit = 2;
|
didit = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(didit > 0)
|
||||||
|
BrokenItems.Add(WhatBreak);
|
||||||
if (didit > 0) Console.WriteLine("Broke it:" + What.hostname + " : " + How + " : " + Data);
|
if (didit > 0) Console.WriteLine("Broke it:" + What.hostname + " : " + How + " : " + Data);
|
||||||
if (didit == 0) Console.WriteLine("Did not break it:" + What.hostname + " : " + How + " : " + Data);
|
if (didit == 0) Console.WriteLine("Did not break it:" + What.hostname + " : " + How + " : " + Data);
|
||||||
return didit;
|
return didit;
|
||||||
|
Loading…
Reference in New Issue
Block a user