Exemplo n.º 1
0
        public void UpdateDest()
        {
            // DestInfos = Clone<BaseDataInfo>(SrcInfos);
            DestInfos = SrcInfos.DeepClone();
            string path = GetMapPath();

            if (File.Exists(path))
            {
                var mapperInfos = MappInfo.Deserialize(path);
                var tmp         = new List <BaseDataInfo>();
                DestInfos.ForEach(x =>
                {
                    var info = mapperInfos.FirstOrDefault(y => y.Key == x.技能组);
                    if (info != null)
                    {
                        if (info.Value == "-1")
                        {
                            // DestInfos.Remove(x);
                        }
                        else
                        {
                            x.技能组 = info.Value;
                            tmp.Add(x);
                        }
                    }
                    else
                    {
                        tmp.Add(x);
                    }
                });
                DestInfos = tmp;
            }
        }
Exemplo n.º 2
0
        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("操作完成");
        }
Exemplo n.º 3
0
        private void InitMapper()
        {
            string path = GetMapPath();

            if (File.Exists(path))
            {
                mapperInfos = MappInfo.Deserialize(path);
            }
            InitGroups(GroupsList);
        }
Exemplo n.º 4
0
 private void InitGroups(List <string> groups)
 {
     groups.Sort();
     groups.ForEach(x =>
     {
         var info = mapperInfos.FirstOrDefault(y => y.Key == x);
         if (info == null)
         {
             info = new MappInfo()
             {
                 Key = x, Value = x
             };
         }
         lv_groups.Items.Add(new ListViewItem()
         {
             Text        = info.Value,
             Tag         = info,
             ToolTipText = info.Key
         });
     });
 }