Get Action list to save
This commit is contained in:
		| @@ -12,11 +12,7 @@ namespace EduNetworkBuilder | |||||||
|         Network StartingState = null; |         Network StartingState = null; | ||||||
|         public List<NetworkAction> NetActions = new List<NetworkAction>(); |         public List<NetworkAction> NetActions = new List<NetworkAction>(); | ||||||
|         NetworkAction CurrentNetAction = null; |         NetworkAction CurrentNetAction = null; | ||||||
|         bool _HasUnsavedChanges = false; |         public bool HasUnsavedChanges = false; | ||||||
|         public bool HasUnsavedChanges { |  | ||||||
|             get { return _HasUnsavedChanges; } |  | ||||||
|             private set { _HasUnsavedChanges = value; } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public Network GetNet { get { return StartingState; } } |         public Network GetNet { get { return StartingState; } } | ||||||
|         public int GetActionCount {  get { if (CurrentNetAction == null) return 0; return CurrentNetAction.Actions.Count; } } |         public int GetActionCount {  get { if (CurrentNetAction == null) return 0; return CurrentNetAction.Actions.Count; } } | ||||||
| @@ -119,6 +115,7 @@ namespace EduNetworkBuilder | |||||||
|         /// This tells us if it has been stored to the long-term action list. |         /// This tells us if it has been stored to the long-term action list. | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         public bool HasBeenStored = false; |         public bool HasBeenStored = false; | ||||||
|  |         public NetworkAction() { } | ||||||
|         public NetworkAction(string Name) |         public NetworkAction(string Name) | ||||||
|         { |         { | ||||||
|             NetworkName = Name; |             NetworkName = Name; | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ namespace EduNetworkBuilder | |||||||
|         private IPAddress theNetmask; |         private IPAddress theNetmask; | ||||||
|         private IPAddress theGateway; |         private IPAddress theGateway; | ||||||
|  |  | ||||||
|  |         public NB_IPAddress() { } //used for reflection  | ||||||
|         public NB_IPAddress(string ip, string mask, IPAddressType WhatType) |         public NB_IPAddress(string ip, string mask, IPAddressType WhatType) | ||||||
|         { |         { | ||||||
|             myType = WhatType; |             myType = WhatType; | ||||||
|   | |||||||
| @@ -297,6 +297,7 @@ namespace EduNetworkBuilder | |||||||
|         public string Destination; |         public string Destination; | ||||||
|         public FirewallRuleType Action; |         public FirewallRuleType Action; | ||||||
|  |  | ||||||
|  |         public FirewallRule() { } | ||||||
|         public FirewallRule(string source, string dest, FirewallRuleType action) |         public FirewallRule(string source, string dest, FirewallRuleType action) | ||||||
|         { |         { | ||||||
|             Source = source; |             Source = source; | ||||||
|   | |||||||
| @@ -227,6 +227,16 @@ namespace EduNetworkBuilder | |||||||
|             //return the id and increment it. |             //return the id and increment it. | ||||||
|             return NextID++; |             return NextID++; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// We are saving the ReplayActions.  Right now, we are doing this for automatic testing | ||||||
|  |         /// of the puzzles.  Regression Testing | ||||||
|  |         /// </summary> | ||||||
|  |         public void SaveActions() | ||||||
|  |         { | ||||||
|  |             NB.WriteToXmlFile(@"c:\Users\TimYo\Desktop\EduNetworkReplay.xml", UserActions); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         public void Save(bool UsingMono) |         public void Save(bool UsingMono) | ||||||
|         { |         { | ||||||
|             if(UsingMono) |             if(UsingMono) | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ namespace EduNetworkBuilder | |||||||
|         public bool TaskWasDone = false; |         public bool TaskWasDone = false; | ||||||
|         public int PacketNumber = -1; |         public int PacketNumber = -1; | ||||||
|  |  | ||||||
|  |         public NetTest() { } | ||||||
|         public NetTest(string srcHost, string dstHost, NetTestType tTest) |         public NetTest(string srcHost, string dstHost, NetTestType tTest) | ||||||
|         { |         { | ||||||
|             sHost = srcHost; |             sHost = srcHost; | ||||||
|   | |||||||
| @@ -91,7 +91,7 @@ namespace EduNetworkBuilder | |||||||
|         public SchoolworkClass WhatFrom = null; |         public SchoolworkClass WhatFrom = null; | ||||||
|         public List<string> ColorNames = new List<string>() { "Black", "White", "Green", "LightGreen", "Blue", "LightBlue", "Gray", "Brown", "SaddleBrown", "Empty" }; |         public List<string> ColorNames = new List<string>() { "Black", "White", "Green", "LightGreen", "Blue", "LightBlue", "Gray", "Brown", "SaddleBrown", "Empty" }; | ||||||
|  |  | ||||||
|  |           | ||||||
|         public Network(string Name) |         public Network(string Name) | ||||||
|         { |         { | ||||||
|             TheNetImage = new Bitmap(myWidth, myHeight); |             TheNetImage = new Bitmap(myWidth, myHeight); | ||||||
|   | |||||||
| @@ -2858,14 +2858,28 @@ namespace EduNetworkBuilder | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|             private void storeReplayToolStripMenuItem_Click(object sender, EventArgs e) |         private void storeReplayToolStripMenuItem_Click(object sender, EventArgs e) | ||||||
|         { |         { | ||||||
|             StoreReplay(); |             StoreReplay(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         void SaveReplayFile() | ||||||
|  |         { | ||||||
|  |             NBSettings ourSettings = NB.GetSettings(); | ||||||
|  |             if (OurSettings != null && OurSettings.ReplayMode) | ||||||
|  |             { | ||||||
|  |                 ActionCollection AC = OurSettings.GetUserActionCollection(); | ||||||
|  |                 if (AC.HasUnsavedChanges) | ||||||
|  |                 { | ||||||
|  |                     ourSettings.SaveActions(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|         private void saveReplayToolStripMenuItem_Click(object sender, EventArgs e) |         private void saveReplayToolStripMenuItem_Click(object sender, EventArgs e) | ||||||
|         { |         { | ||||||
|  |             SaveReplayFile(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -36,6 +36,8 @@ namespace EduNetworkBuilder | |||||||
|  |  | ||||||
|         public int IFCount { get { return interfaces.Count; } } |         public int IFCount { get { return interfaces.Count; } } | ||||||
|  |  | ||||||
|  |         public NetworkCard() { } | ||||||
|  |  | ||||||
|         public NetworkCard(int index, int HostID, string hostname, NicType theType = NicType.eth) |         public NetworkCard(int index, int HostID, string hostname, NicType theType = NicType.eth) | ||||||
|         { |         { | ||||||
|             myNicType = theType; |             myNicType = theType; | ||||||
|   | |||||||
| @@ -40,7 +40,8 @@ namespace EduNetworkBuilder | |||||||
|         private List<string> tracertmessages = new List<string>(); |         private List<string> tracertmessages = new List<string>(); | ||||||
|         public int BadSprayCount = 0; |         public int BadSprayCount = 0; | ||||||
|         public List<int> PacketIDsPassedThrough = new List<int>(); |         public List<int> PacketIDsPassedThrough = new List<int>(); | ||||||
|          |  | ||||||
|  |         public NetworkDevice() { } | ||||||
|         public NetworkDevice(NetworkComponentType what, string tHostname, Point tLocation, NicType firstNic = NicType.eth) |         public NetworkDevice(NetworkComponentType what, string tHostname, Point tLocation, NicType firstNic = NicType.eth) | ||||||
|         { |         { | ||||||
|             hostname = tHostname; |             hostname = tHostname; | ||||||
|   | |||||||
| @@ -17,6 +17,9 @@ namespace EduNetworkBuilder | |||||||
|         public HostNicID AttachedToHostNic; |         public HostNicID AttachedToHostNic; | ||||||
|         public List<VLANInfo> VLANs = new List<VLANInfo>() { new VLANInfo(1, VLANTagType.Untagged ) }; |         public List<VLANInfo> VLANs = new List<VLANInfo>() { new VLANInfo(1, VLANTagType.Untagged ) }; | ||||||
|         //We should have a feature: none, IP_in_IP_Tunnel, encrypted_vpn, vlan, etc |         //We should have a feature: none, IP_in_IP_Tunnel, encrypted_vpn, vlan, etc | ||||||
|  |  | ||||||
|  |         public NetworkInterface() { } | ||||||
|  |  | ||||||
|         public NetworkInterface(string name, string IP, string Mask, HostNicID AttachedTo) |         public NetworkInterface(string name, string IP, string Mask, HostNicID AttachedTo) | ||||||
|         { |         { | ||||||
|             nic_name = name; |             nic_name = name; | ||||||
|   | |||||||
| @@ -17,6 +17,8 @@ namespace EduNetworkBuilder | |||||||
|         public LinkType theLinkType = LinkType.normal; |         public LinkType theLinkType = LinkType.normal; | ||||||
|         public bool isVisibleLink = true;  //False for wireless.  Skip drawing a line if it is there |         public bool isVisibleLink = true;  //False for wireless.  Skip drawing a line if it is there | ||||||
|  |  | ||||||
|  |         public NetworkLink() { } | ||||||
|  |  | ||||||
|         public NetworkLink(HostNicID source, HostNicID dest, LinkType type = LinkType.normal) |         public NetworkLink(HostNicID source, HostNicID dest, LinkType type = LinkType.normal) | ||||||
|         { |         { | ||||||
|             SrcNic = source; |             SrcNic = source; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user