Exemplo n.º 1
0
 internal void LoadMachineSection()
 {
     try
     {
         var contentsMachine = File.ReadAllText(MachineStoragePath);
         Machine = JsonConvert.DeserializeObject <MachineSection>(contentsMachine);
     }
     catch (FileNotFoundException)
     {
         Machine = MachineSection.GetDefault();
         SaveMachineSection();
     }
 }
Exemplo n.º 2
0
        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();
            }
        }