예제 #1
0
        public virtual T ReadData(string path, bool mustBeBackedUp = false)
        {
            if (mustBeBackedUp)
            {
                FileBackUp.BackUpFile(path);
            }

            T data;

            using (TextReader reader = new StreamReader(path))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(DATA));
                data = (T)serializer.Deserialize(reader);
            }
            return(data);
        }
예제 #2
0
        public override BaseData ReadData(string path, bool mustBeBackedUp)
        {
            if (mustBeBackedUp)
            {
                FileBackUp.BackUpFile(path);
            }

            DATA data;

            using (TextReader reader = new StreamReader(path))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(DATA));
                data = (DATA)serializer.Deserialize(reader);
            }

            return(data);
        }