예제 #1
0
        /// <summary>
        /// 保存配置
        /// </summary>
        public static void SaveConfig()
        {
            if (Config == null)
            {
                Config = new RobotConfig();
            }
            string xml = XmlUtil.Serializer(typeof(RobotConfig), Config);

            File.WriteAllText(ConfigPath, xml);
        }
예제 #2
0
 /// <summary>
 /// 载入配置
 /// </summary>
 public static void LoadConfig()
 {
     if (File.Exists(ConfigPath))
     {
         Config = (RobotConfig)XmlUtil.Deserialize(typeof(RobotConfig), File.ReadAllText(ConfigPath));
     }
     else
     {
         Config = new RobotConfig();
         SaveConfig();
     }
 }