private void btn_Save_Click(object sender, EventArgs e) { string path = GetXmlPath(); if (File.Exists(path)) { File.Move(path, string.Format("{0}_{1}.bak", path, DateTime.Now.ToString().Replace(":", "_").Replace("-", "_").Replace("/", "_"))); } NDirectory.Serialize(path); string mapPath = GetMapPath(); if (File.Exists(mapPath)) { File.Move(mapPath, string.Format("{0}_{1}.bak", mapPath, DateTime.Now.ToString().Replace(":", "_").Replace("-", "_").Replace("/", "_"))); } mapperInfos.Clear(); foreach (ListViewItem item in lv_groups.Items) { MappInfo info = item.Tag as MappInfo; if (info.Key != info.Value) { mapperInfos.Add(info); } } MappInfo.Serialize(mapPath, mapperInfos); MessageBox.Show("操作完成"); }