예제 #1
0
        void SaveConfig()
        {
            BeamNGConfig save = new BeamNGConfig();

            int.TryParse(portTextBox.Text, out save.port);

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

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

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

                portTextBox.Text = "" + config.port;
            }
        }