public static Configuration Load()
{
XmlSerializer xml = new XmlSerializer(typeof(Configuration));
string common = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string folder = Path.Combine(common, "ohSongcast");
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}
string path = Path.Combine(folder, "Configuration.xml");
if (!File.Exists(path))
{
return (New(path));
}
try
{
using (TextReader reader = new StreamReader(path))
{
Configuration configuration = (Configuration)xml.Deserialize(reader);
configuration.SetPath(path);
return (configuration);
}
}
catch (Exception)
{
return (New(path));
}
}