private void InitRobotConfig() { // Robot meta information if (!File.Exists(RobotConfigIO.CONFIG_FILE)) { RobotConfigIO.WriteConfig(new RobotConfig() { ID = 0, Name = "Dummy" }, RobotConfigIO.CONFIG_FILE); MessageBox.Show( "No config for the bot present!\r\n" + "Generating a default one at " + RobotConfigIO.CONFIG_FILE + "\r\n" + "Please enter the meta-information for the robot"); } _robotConfig = RobotConfigIO.ReadConfig(RobotConfigIO.CONFIG_FILE); }
/// <summary> /// Writes the given config to the specified file. /// </summary> /// <param name="config">The config to write.</param> /// <param name="path">The path to write the config to.</param> public static void WriteConfig(RobotConfig config, string path) { using (StreamWriter sw = new StreamWriter(path)) _serializer.Serialize(sw, config); }