示例#1
0
        public static void Save(ListeningLists listeningLists)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ListeningLists));

            using (XmlWriter xmlWriter = XmlWriter.Create(ListeningLists.FILENAME))
            {
                serializer.Serialize(xmlWriter, listeningLists);
            }
        }
示例#2
0
        private void SaveLists()
        {
            ListeningLists listeningLists = new ListeningLists()
            {
                WhiteList = SaveSourcesFromGrid(dgWhiteList),
                BlackList = SaveSourcesFromGrid(dgBlackList)
            };

            ListeningLists.Save(listeningLists);
        }
示例#3
0
        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;
        }