public static AppSettings loadSettings() { AppSettings settings = new AppSettings(); String level = null; String unlockedLevel = null; try { level = (String)appSettings["level"]; } catch (System.Collections.Generic.KeyNotFoundException ex) { } try { unlockedLevel = (String)appSettings["unlockedLevel"]; } catch (System.Collections.Generic.KeyNotFoundException ex) { } if (!String.IsNullOrEmpty(level)) settings.setLevel(Int16.Parse(level)); if (!String.IsNullOrEmpty(unlockedLevel)) settings.unlockLevel(Int16.Parse(unlockedLevel)); return settings; }
public static void saveSettings(AppSettings settings) { appSettings["level"] = settings.getLevel().ToString(); appSettings["unlockedLevel"] = settings.getUnlockedLevel().ToString(); }