public void ExportData(string path, string zipname, string _cdbfile) { int i = 0; Card[] cards = cardlist; if (cards == null || cards.Length == 0) { return; } int count = cards.Length; YgoPath ygopath = new YgoPath(path); string name = Path.GetFileNameWithoutExtension(zipname); //数据库 string cdbfile = zipname + ".cdb"; //说明 string readme = MyPath.Combine(path, name + ".txt"); //新卡ydk string deckydk = ygopath.GetYdk(name); File.Delete(cdbfile); DataBase.Create(cdbfile); DataBase.CopyDB(cdbfile, false, cardlist); if (File.Exists(zipname)) { File.Delete(zipname); } using (ZipStorer zips = ZipStorer.Create(zipname, "")) { zips.AddFile(cdbfile, Path.GetFileNameWithoutExtension(_cdbfile) + ".cdb", ""); if (File.Exists(readme)) { zips.AddFile(readme, "readme_" + name + ".txt", ""); } if (File.Exists(deckydk)) { zips.AddFile(deckydk, "deck/" + name + ".ydk", ""); } foreach (Card c in cards) { i++; worker.ReportProgress(i / count, string.Format("{0}/{1}", i, count)); string[] files = ygopath.GetCardfiles(c.id); foreach (string file in files) { if (File.Exists(file)) { zips.AddFile(file, file.Replace(path, ""), ""); } } } } File.Delete(cdbfile); }