Example #1
0
 static UserPreferences()
 {
     g_current = new UserPreferences();
 }
Example #2
0
        /// <summary>
        /// Loads the current user preferences from a file.
        /// </summary>
        public static void Load()
        {
            //
            // Create directory if needed.
            //
            Directory.CreateDirectory(Path.GetDirectoryName(FilePath));

            if (!File.Exists(FilePath))
                return;

            try
            {
                TextReader settingsFile = new StreamReader(FilePath);
                XmlSerializer xmls = new XmlSerializer(g_current.GetType());
                g_current = xmls.Deserialize(settingsFile) as UserPreferences;
                settingsFile.Close();
            }
            catch (Exception e)
            {
                throw e;
            }
        }