internal void LoadMachineSection() { try { var contentsMachine = File.ReadAllText(MachineStoragePath); Machine = JsonConvert.DeserializeObject <MachineSection>(contentsMachine); } catch (FileNotFoundException) { Machine = MachineSection.GetDefault(); SaveMachineSection(); } }
internal void LoadMachineSection(string path = null) { if (Machine != null) { SaveMachineSection(); } var configPath = File.Exists(path) ? path : MachineStoragePath; try { var contentsMachine = File.ReadAllText(configPath); Machine = JsonConvert.DeserializeObject <MachineSection>(contentsMachine); Machine.ConfigPath = configPath; } catch (FileNotFoundException) { Machine = MachineSection.GetDefault(); Machine.ConfigPath = configPath; SaveMachineSection(); } }