Esempio n. 1
0
        void SaveConfig()
        {
            WreckfestExperimentsConfig save = new WreckfestExperimentsConfig();

            save.selectedVehicle = (string)vehicleSelector.SelectedItem;

            string output = JsonConvert.SerializeObject(save, Formatting.Indented);

            File.WriteAllText(saveFilename, output);
        }
Esempio n. 2
0
        void LoadConfig()
        {
            if (File.Exists(saveFilename))
            {
                string text = File.ReadAllText(saveFilename);

                WreckfestExperimentsConfig config = JsonConvert.DeserializeObject <WreckfestExperimentsConfig>(text);

                for (int i = 0; i < vehicleSelector.Items.Count; ++i)
                {
                    if (((string)vehicleSelector.Items[i]).CompareTo(config.selectedVehicle) == 0)
                    {
                        Utils.SetComboBoxSelectedIndexThreadSafe(vehicleSelector, i);
                        break;
                    }
                }
            }
        }