trigger multiple spray packets even after the packet is done.
This commit is contained in:
		@@ -373,6 +373,8 @@ namespace EduNetworkBuilder
 | 
			
		||||
        public static int NormalRotation = 5;
 | 
			
		||||
        public static int PacketDamageDistance = 25;
 | 
			
		||||
 | 
			
		||||
        public static int NumBadPackets = 3; //the number of packets to spray out
 | 
			
		||||
 | 
			
		||||
        public static string AllowedPasswordCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!~@#$%^&*()_+{}[]/?<>,.";
 | 
			
		||||
        public static string AllowedUsernameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890._";
 | 
			
		||||
        /// <summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
        public bool PuzzleIsSolved = true;  //only set to false if we load a puzzle
 | 
			
		||||
        public List<HelpTopics> SuggestedReadings = new List<HelpTopics>();
 | 
			
		||||
        private DateTime NetworkStartTime = DateTime.Now;
 | 
			
		||||
        private DateTime NextSprayTime = DateTime.Now;
 | 
			
		||||
        private bool AlreadyChosenTimeout = false;
 | 
			
		||||
        private int DefaultTimeout = 10;
 | 
			
		||||
        private int NumberOfSecondsForTimeout = 10;
 | 
			
		||||
@@ -1603,6 +1604,20 @@ namespace EduNetworkBuilder
 | 
			
		||||
                {
 | 
			
		||||
                    if (Animations[i].AnimationDone) Animations.RemoveAt(i);
 | 
			
		||||
                }
 | 
			
		||||
                if(DateTime.Now > NextSprayTime)
 | 
			
		||||
                {
 | 
			
		||||
                    Random myRnd = NB.GetRandom();
 | 
			
		||||
                    int ms = (myRnd.Next(10) + 2) * 250;
 | 
			
		||||
                    NextSprayTime = DateTime.Now.AddMilliseconds(ms);
 | 
			
		||||
                    foreach(NetworkComponent NC in NetComponents)
 | 
			
		||||
                    {
 | 
			
		||||
                        if(NC is NetworkDevice)
 | 
			
		||||
                        {
 | 
			
		||||
                            NetworkDevice ND = (NetworkDevice)NC;
 | 
			
		||||
                            ND.BadPacketIfIShould();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //if (myPackets.Count > 50)
 | 
			
		||||
                //Console.WriteLine("Packets: " + myPackets.Count.ToString());
 | 
			
		||||
 
 | 
			
		||||
@@ -486,6 +486,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
                tPacket.Tracking.Status = NB.Translate("N_ProssShouldContinTime");
 | 
			
		||||
                tPacket.MyStatus = PacketStatus.finished_failed;
 | 
			
		||||
                //Then, we make a bad packet go out from here
 | 
			
		||||
                WhereFrom.BadSprayCount = NB.NumBadPackets;
 | 
			
		||||
                WhereFrom.BadPacketFromHere();
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
@@ -773,6 +774,8 @@ namespace EduNetworkBuilder
 | 
			
		||||
                tPacket.MyStatus = PacketStatus.finished_failed;
 | 
			
		||||
                //Then, we make a bad packet go out from here
 | 
			
		||||
                nd.BadPacketFromHere();
 | 
			
		||||
                nd.BadSprayCount = NB.NumBadPackets;
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            if (mynet.ItemHasTest(nd.hostname,NetTestType.DeviceIsFrozen))
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
        public  List<FirewallRule> FirewallRules = new List<FirewallRule>();
 | 
			
		||||
        public bool PowerOff = false;
 | 
			
		||||
        private List<string> tracertmessages = new List<string>();
 | 
			
		||||
        public int BadSprayCount = 0;
 | 
			
		||||
        
 | 
			
		||||
        public NetworkDevice(NetworkComponentType what, string tHostname, Point tLocation, NicType firstNic = NicType.eth)
 | 
			
		||||
        {
 | 
			
		||||
@@ -1594,6 +1595,15 @@ namespace EduNetworkBuilder
 | 
			
		||||
            myNet.addPacket(BadPacket);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void BadPacketIfIShould()
 | 
			
		||||
        {
 | 
			
		||||
            if(BadSprayCount > 0)
 | 
			
		||||
            {
 | 
			
		||||
                BadPacketFromHere();
 | 
			
		||||
                BadSprayCount--;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void TracerouteFromHere(NB_IPAddress Destination)
 | 
			
		||||
        {
 | 
			
		||||
            //We need to create a traceroute packet - start with 1 TTL
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user