public static void SetExpectedTemperature(SettingsEntry entry) { var settings = new TemperatureSettings { Settings = GetDefaultSettings() }; SaveSettings(settings); }
public static void SaveSettings(TemperatureSettings settings) { if (settings == null) { settings = new TemperatureSettings { Id = Guid.NewGuid(), Settings = GetDefaultSettings() }; } var appdata = AppDomain.CurrentDomain.GetData("DataDirectory").ToString(); var path = $@"{appdata}\TemperatureSettings.json"; var settingsJson = JsonConvert.SerializeObject(settings, Formatting.Indented); File.WriteAllText(path, settingsJson); }