using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace iTripLog.Upload
{
    class Settings
    {
        public string FlickrAuthToken { get; set; }
        public static Settings Load(string filename)
        {
            if (File.Exists(filename) == false)
                return new Settings();

            XmlSerializer ser = new XmlSerializer(typeof(Settings));
            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                return ser.Deserialize(fs) as Settings;
            }
        }

        public void Save(string filename)
        {
            XmlSerializer ser = new XmlSerializer(typeof(Settings));
            using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
            {
                ser.Serialize(fs, this);
            }
        }
    }
}
