Exemplo n.º 1
0
        // Save
        public void XMLSerialize(xmlDataConfig config, string filepath)
        {
            serialzer = new XmlSerializer(typeof(xmlDataConfig));
            TextWriter writer = new StreamWriter(filepath);

            serialzer.Serialize(writer, config);
            writer.Close();
        }
Exemplo n.º 2
0
        // Load
        public xmlDataConfig XMLDeserialize(string filePath, xmlDataConfig config)
        {
            serialzer = new XmlSerializer(typeof(xmlDataConfig));
            stream    = new FileStream(filePath, FileMode.Open);
            config    = (xmlDataConfig)serialzer.Deserialize(stream);
            stream.Close();

            return(config);
        }
Exemplo n.º 3
0
        // Create
        public void XMLCreate(xmlDataConfig config, string filepath)
        {
            XmlSerializer writer = new XmlSerializer(typeof(xmlDataConfig));

            using (StreamWriter sw = new StreamWriter(new FileStream(filepath, FileMode.Create), Encoding.UTF8))
            {
                writer.Serialize(sw, config);
            }
        }