public static void Save(StatisticsStrategyConfiguration configuration) { try { var content = JsonConvert.SerializeObject(configuration, Formatting.Indented); File.WriteAllText(ConfigFile, content); } catch (Exception e) { Logging.LogUsefulException(e); } }
public static StatisticsStrategyConfiguration Load() { try { var content = File.ReadAllText(ConfigFile); var configuration = JsonConvert.DeserializeObject <StatisticsStrategyConfiguration>(content); return(configuration); } catch (FileNotFoundException) { var configuration = new StatisticsStrategyConfiguration(); Save(configuration); return(configuration); } catch (Exception e) { Logging.LogUsefulException(e); return(new StatisticsStrategyConfiguration()); } }