public static void Save(ListeningLists listeningLists) { XmlSerializer serializer = new XmlSerializer(typeof(ListeningLists)); using (XmlWriter xmlWriter = XmlWriter.Create(ListeningLists.FILENAME)) { serializer.Serialize(xmlWriter, listeningLists); } }
private void SaveLists() { ListeningLists listeningLists = new ListeningLists() { WhiteList = SaveSourcesFromGrid(dgWhiteList), BlackList = SaveSourcesFromGrid(dgBlackList) }; ListeningLists.Save(listeningLists); }
public static ListeningLists Load() { ListeningLists listeningLists = new ListeningLists(); if (File.Exists(ListeningLists.FILENAME)) { XmlSerializer serializer = new XmlSerializer(typeof(ListeningLists)); using (XmlReader xmlReader = XmlReader.Create(ListeningLists.FILENAME)) { listeningLists = (ListeningLists)serializer.Deserialize(xmlReader); } } return listeningLists; }