using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Kindlebox { internal class UpdateJson { public UpdateJson() { } public UpdateJson(string _arg) { if (_arg == "rabbits") { UpdateRabbits(); } else if(_arg == "litters") { UpdateLitters(); } else if (_arg == "breedings") { UpdateBreedings(); } else if (_arg == "all") { UpdateRabbits(); UpdateLitters(); UpdateBreedings(); } } public static void UpdateRabbits() { string fileName = Properties.Settings.Default.RabbitFile; var json = JsonConvert.SerializeObject(RabbitList.rabbits); System.IO.File.WriteAllText(fileName, json); } public static void UpdateLitters() { string fileName = Properties.Settings.Default.LitterFile; var json = JsonConvert.SerializeObject(LitterList.litters); System.IO.File.WriteAllText(fileName, json); } public static void UpdateBreedings() { string fileName = Properties.Settings.Default.BreedingFile; var json = JsonConvert.SerializeObject(BreedingList.breedings); System.IO.File.WriteAllText(fileName, json); } } }