ability to load / save the messages

This commit is contained in:
Tim Young 2017-08-17 09:57:23 -05:00
parent c4c5984f21
commit aed5340351

View File

@ -236,6 +236,9 @@ namespace EduNetworkBuilder
SuggestedReadings.Add(tempHelpTopic); SuggestedReadings.Add(tempHelpTopic);
} }
break; break;
case "packetmessages":
myMessages = NB.Deserialize<List<PacketMessage>>(Individual.InnerText);
break;
case "level": case "level":
int.TryParse(Individual.InnerText, out Level); int.TryParse(Individual.InnerText, out Level);
//Tags.Add("Level_" + Individual.InnerText); //Tags.Add("Level_" + Individual.InnerText);
@ -337,7 +340,7 @@ namespace EduNetworkBuilder
} }
public void Save(XmlWriter writer, bool StraightToFile = true) public void Save(XmlWriter writer, bool StraightToFile = true, bool SaveMessages = false)
{ {
//Save the language name //Save the language name
//save the number of items //save the number of items
@ -359,6 +362,11 @@ namespace EduNetworkBuilder
writer.WriteElementString("VLANPacketColors", VLANPacketColors.ToString()); writer.WriteElementString("VLANPacketColors", VLANPacketColors.ToString());
if (!StraightToFile) if (!StraightToFile)
writer.WriteElementString("PuzzleName", PuzzleName); writer.WriteElementString("PuzzleName", PuzzleName);
if(SaveMessages)
{
string serializedstring = NB.SerializeObject<List<PacketMessage>>(myMessages);
writer.WriteElementString("PacketMessages", serializedstring);
}
//Save all the devices //Save all the devices
for (int loop = 0; loop < NetComponents.Count; loop++) for (int loop = 0; loop < NetComponents.Count; loop++)
{ {