Get loading / saving of packetmessages working. They had been lost during the clone operation.

This commit is contained in:
Tim Young 2017-08-17 13:50:29 -05:00
parent 7f6c8be406
commit 1c703c60b5
2 changed files with 21 additions and 0 deletions

View File

@ -1131,6 +1131,16 @@ namespace EduNetworkBuilder
return myMessages[index];
}
public List<PacketMessage> GetAllMessages()
{
List<PacketMessage> newlist = new List<PacketMessage>();
foreach(PacketMessage one in myMessages)
{
newlist.Add(PacketMessage.Clone<PacketMessage>(one));
}
return newlist;
}
public void addPacket(Packet toadd)
{
if (toadd != null && !myPackets.Contains(toadd))

View File

@ -54,7 +54,18 @@ namespace EduNetworkBuilder
{
List<SchoolworkClass> 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)