From 1c703c60b543b4b881aaa6eb21581631f288a20f Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 17 Aug 2017 13:50:29 -0500 Subject: [PATCH] Get loading / saving of packetmessages working. They had been lost during the clone operation. --- EduNetworkBuilder/Network.cs | 10 ++++++++++ EduNetworkBuilder/SchoolworkClass.cs | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 1bafacc..4418c9a 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1131,6 +1131,16 @@ namespace EduNetworkBuilder return myMessages[index]; } + public List GetAllMessages() + { + List newlist = new List(); + foreach(PacketMessage one in myMessages) + { + newlist.Add(PacketMessage.Clone(one)); + } + return newlist; + } + public void addPacket(Packet toadd) { if (toadd != null && !myPackets.Contains(toadd)) diff --git a/EduNetworkBuilder/SchoolworkClass.cs b/EduNetworkBuilder/SchoolworkClass.cs index 65300bd..ae446aa 100644 --- a/EduNetworkBuilder/SchoolworkClass.cs +++ b/EduNetworkBuilder/SchoolworkClass.cs @@ -54,7 +54,18 @@ namespace EduNetworkBuilder { List WhatIs = Load(TheNode); if (WhatIs.Count > 0) + { SchoolworkClass.Clone(WhatIs[0], this); + //Move the packet messages across. They do not get cloned. + //We do this so we can store the results of an automated test + if(WhatIs[0].theProject != null && WhatIs[0].theProject.CountMessages() > 0) + { + foreach(PacketMessage one in WhatIs[0].theProject.GetAllMessages()) + { + theProject.AddMessage(one); + } + } + } } public SchoolworkClass(string FileName)