Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            file.Info.Clear();
            foreach (Context v in bind)
            {
                if (file.Info.ContainsKey(v.Name))
                {
                    MessageBox.Show("检查到重复的键\"" + v.Name + "\",请自行删除");
                }
                else
                {
                    file.Info.Add(v.Name, v.info);
                }
            }


            if (Dic.ContainsKey(pathC))
            {
                FileInfo info = new FileInfo(Dic[this.pathC]);
                file.Serialize(info);
                MessageBox.Show("保存完毕");
            }
            else
            {
                MessageBox.Show("未找到源文件与信息文件的关联");
            }
        }
Example #2
0
 private InfoFile GetInfoFile(string pathC)
 {
     if (!Dic.ContainsKey(pathC))
     {
         Dic.Add(pathC, "InfoFolder\\" + DateTime.Now.Ticks.ToString());
         SaveDic();
         InfoFile file = new InfoFile(new FileInfo(pathC));
         file.Serialize(new FileInfo(Dic[pathC]));
         return(file);
     }
     else
     {
         return(InfoFile.Parse(Dic[pathC]));
     }
 }