Example #1
0
        public static void Update3dsdbXMLFile()
        {
            FileInfo l3dsdb = new FileInfo(Path.Combine(BQDirectory.DBDir, _3dsreleasesFileName));

            BQLog.WriteMsgToUI("开始更新3dsrelease.xml");
            if (!l3dsdb.Exists)
            {
                BQLog.WriteMsgToUI("开始从3dsdb.com下载");
                BQWeb.DownloadWebFile(URL3dsdb, l3dsdb);
            }
            else
            {
                FileInfo l3dsdbNew = new FileInfo(l3dsdb.FullName + "new");
                if (l3dsdbNew.Exists)
                {
                    BQLog.WriteMsgToUI("删除上次残留的3dsrelease.xml文件");
                    l3dsdbNew.Delete();
                }
                BQLog.WriteMsgToUI("开始从3dsdb.com下载");
                BQWeb.DownloadWebFile(URL3dsdb, l3dsdbNew);
                l3dsdb.Delete();
                l3dsdbNew.MoveTo(l3dsdb.FullName);
            }

            BQLog.WriteMsgToUI("3dsrelease.xml更新成功");
        }
        public static void DownLoadRomConver(RomInformation pRomInfo)
        {
            string lWebSoruce = "";

            lWebSoruce = BQWeb.DownloadWebHtml(URL3dsdb + pRomInfo.BasicInfo.SubSerial);
            lWebSoruce = lWebSoruce.Replace("\n", "");
            lWebSoruce = lWebSoruce.Replace("\r", "");

            MatchCollection lResult = Regex.Matches(lWebSoruce, _RegexImagePattern);

            if (lResult.Count <= 0)
            {
                return;
            }

            foreach (Match match in lResult)
            {
                GroupCollection gc             = match.Groups;
                FileInfo        tRomConverFile = SavePic(gc["imgLink"].ToString());
            }
        }
        private static FileInfo SavePic(string pUrl)
        {
            // http://art.gametdb.com/3ds/coverM/JA/AVSJ.jpg
            string[] lInfoList   = pUrl.Split('/');
            string   lFileName   = lInfoList[lInfoList.Length - 1];
            string   lFolderName = lInfoList[lInfoList.Length - 3] + "\\" + lInfoList[lInfoList.Length - 2];

            FileInfo fileInfo = new FileInfo(Path.Combine(BQDirectory.ConverDir, lFolderName, lFileName));

            if (fileInfo.Exists)
            {
                return(fileInfo);
            }

            if (Directory.Exists(fileInfo.DirectoryName) == false)
            {
                Directory.CreateDirectory(fileInfo.DirectoryName);
            }

            BQWeb.DownloadWebFile(pUrl, fileInfo);

            return(fileInfo);
        }