private void SetSettingsTOTransferInfo() { if (File.Exists(SettingsControl.settsPath)) { string txt = File.ReadAllText(SettingsControl.settsPath); SavingSettingsClass loadedSaveObject = JsonSerializer.Deserialize <SavingSettingsClass>(txt); TransferInfo.idOnReleases = loadedSaveObject.idOnReleases; TransferInfo.namesInsteadOfIds = loadedSaveObject.namesInsteadOfIds; } else { Save(); } }
private void Save() { SavingSettingsClass setts = new SavingSettingsClass() { idOnReleases = true, namesInsteadOfIds = false }; string json = JsonSerializer.Serialize(setts); TransferInfo.idOnReleases = setts.idOnReleases; TransferInfo.namesInsteadOfIds = setts.namesInsteadOfIds; File.WriteAllText(SettingsControl.settsPath, json); }