コード例 #1
0
 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();
     }
 }
コード例 #2
0
        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);
        }