GetCardfiles() 공개 메소드

public GetCardfiles ( long id ) : string[]
id long
리턴 string[]
예제 #1
0
        //资源改名
        public static void CardRename(long newid, long oldid, YgoPath ygopath)
        {
            string[] newfiles = ygopath.GetCardfiles(newid);
            string[] oldfiles = ygopath.GetCardfiles(oldid);

            for (int i = 0; i < oldfiles.Length; i++)
            {
                if (File.Exists(oldfiles[i]))
                {
                    try {
                        File.Move(oldfiles[i], newfiles[i]);
                    }
                    catch { }
                }
            }
        }
예제 #2
0
 //删除资源
 public static void CardDelete(long id, YgoPath ygopath)
 {
     string[] files = ygopath.GetCardfiles(id);
     for (int i = 0; i < files.Length; i++)
     {
             if (FileSystem.FileExists(files[i]))
                 FileSystem.DeleteFile(files[i], UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
     }
 }
예제 #3
0
        public void ExportData(string path, string zipname)
        {
            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, name + ".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);
        }