diff --git a/EduNetworkBuilder/ActionClass.cs b/EduNetworkBuilder/ActionClass.cs index d67123b..6b7b640 100644 --- a/EduNetworkBuilder/ActionClass.cs +++ b/EduNetworkBuilder/ActionClass.cs @@ -12,11 +12,7 @@ namespace EduNetworkBuilder Network StartingState = null; public List NetActions = new List(); NetworkAction CurrentNetAction = null; - bool _HasUnsavedChanges = false; - public bool HasUnsavedChanges { - get { return _HasUnsavedChanges; } - private set { _HasUnsavedChanges = value; } - } + public bool HasUnsavedChanges = false; public Network GetNet { get { return StartingState; } } 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. /// public bool HasBeenStored = false; + public NetworkAction() { } public NetworkAction(string Name) { NetworkName = Name; diff --git a/EduNetworkBuilder/IPAddress.cs b/EduNetworkBuilder/IPAddress.cs index 638bdc9..fde16cb 100644 --- a/EduNetworkBuilder/IPAddress.cs +++ b/EduNetworkBuilder/IPAddress.cs @@ -24,6 +24,7 @@ namespace EduNetworkBuilder private IPAddress theNetmask; private IPAddress theGateway; + public NB_IPAddress() { } //used for reflection public NB_IPAddress(string ip, string mask, IPAddressType WhatType) { myType = WhatType; diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index 890140b..833d6d7 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -297,6 +297,7 @@ namespace EduNetworkBuilder public string Destination; public FirewallRuleType Action; + public FirewallRule() { } public FirewallRule(string source, string dest, FirewallRuleType action) { Source = source; diff --git a/EduNetworkBuilder/NBSettings.cs b/EduNetworkBuilder/NBSettings.cs index 56397b7..183e545 100644 --- a/EduNetworkBuilder/NBSettings.cs +++ b/EduNetworkBuilder/NBSettings.cs @@ -227,6 +227,16 @@ namespace EduNetworkBuilder //return the id and increment it. return NextID++; } + + /// + /// We are saving the ReplayActions. Right now, we are doing this for automatic testing + /// of the puzzles. Regression Testing + /// + public void SaveActions() + { + NB.WriteToXmlFile(@"c:\Users\TimYo\Desktop\EduNetworkReplay.xml", UserActions); + } + public void Save(bool UsingMono) { if(UsingMono) diff --git a/EduNetworkBuilder/NetTest.cs b/EduNetworkBuilder/NetTest.cs index fd1579e..dc95a10 100644 --- a/EduNetworkBuilder/NetTest.cs +++ b/EduNetworkBuilder/NetTest.cs @@ -23,6 +23,7 @@ namespace EduNetworkBuilder public bool TaskWasDone = false; public int PacketNumber = -1; + public NetTest() { } public NetTest(string srcHost, string dstHost, NetTestType tTest) { sHost = srcHost; diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index d61a986..0f9f857 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -91,7 +91,7 @@ namespace EduNetworkBuilder public SchoolworkClass WhatFrom = null; public List ColorNames = new List() { "Black", "White", "Green", "LightGreen", "Blue", "LightBlue", "Gray", "Brown", "SaddleBrown", "Empty" }; - + public Network(string Name) { TheNetImage = new Bitmap(myWidth, myHeight); diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 345ce61..53a11a0 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -2858,14 +2858,28 @@ namespace EduNetworkBuilder } } - private void storeReplayToolStripMenuItem_Click(object sender, EventArgs e) + private void storeReplayToolStripMenuItem_Click(object sender, EventArgs e) { 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) { - + SaveReplayFile(); } } } \ No newline at end of file diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index 4053257..3a796b2 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -36,6 +36,8 @@ namespace EduNetworkBuilder public int IFCount { get { return interfaces.Count; } } + public NetworkCard() { } + public NetworkCard(int index, int HostID, string hostname, NicType theType = NicType.eth) { myNicType = theType; diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 6eb2297..d8cbf4f 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -40,7 +40,8 @@ namespace EduNetworkBuilder private List tracertmessages = new List(); public int BadSprayCount = 0; public List PacketIDsPassedThrough = new List(); - + + public NetworkDevice() { } public NetworkDevice(NetworkComponentType what, string tHostname, Point tLocation, NicType firstNic = NicType.eth) { hostname = tHostname; diff --git a/EduNetworkBuilder/NetworkInterface.cs b/EduNetworkBuilder/NetworkInterface.cs index b78cb2c..d40dd55 100644 --- a/EduNetworkBuilder/NetworkInterface.cs +++ b/EduNetworkBuilder/NetworkInterface.cs @@ -17,6 +17,9 @@ namespace EduNetworkBuilder public HostNicID AttachedToHostNic; public List VLANs = new List() { new VLANInfo(1, VLANTagType.Untagged ) }; //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) { nic_name = name; diff --git a/EduNetworkBuilder/NetworkLink.cs b/EduNetworkBuilder/NetworkLink.cs index 2559456..f0e3228 100644 --- a/EduNetworkBuilder/NetworkLink.cs +++ b/EduNetworkBuilder/NetworkLink.cs @@ -17,6 +17,8 @@ namespace EduNetworkBuilder public LinkType theLinkType = LinkType.normal; 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) { SrcNic = source;