/// <summary> /// 保存配置 /// </summary> public static void SaveConfig() { if (Config == null) { Config = new RobotConfig(); } string xml = XmlUtil.Serializer(typeof(RobotConfig), Config); File.WriteAllText(ConfigPath, xml); }
/// <summary> /// 载入配置 /// </summary> public static void LoadConfig() { if (File.Exists(ConfigPath)) { Config = (RobotConfig)XmlUtil.Deserialize(typeof(RobotConfig), File.ReadAllText(ConfigPath)); } else { Config = new RobotConfig(); SaveConfig(); } }