Example #1
0
        /// <summary>
        /// Deserialize the applicationsettings.
        /// </summary>
        /// <returns></returns>
        public static ApplicationSettingsModel Deserialize()
        {
            if (File.Exists(_sessionSettingsPath))
            {
                string json = File.ReadAllText(_sessionSettingsPath);
                return(JsonConvert.DeserializeObject <ApplicationSettingsModel>(json));
            }

            var settings = new ApplicationSettingsModel();

            Serialize(settings);

            return(settings);
        }
Example #2
0
        /// <summary>
        /// Serializes the application settings.
        /// </summary>
        /// <param name="settings"></param>
        public static void Serialize(ApplicationSettingsModel settings)
        {
            var json = JsonConvert.SerializeObject(settings, Formatting.Indented);

            FileController.WriteAllText(_sessionSettingsPath, json);
        }