コード例 #1
0
        public override void DownloadImage_Click(object sender, RoutedEventArgs e)
        {
            base.DownloadImage_Click(sender, e);
            string filename = CF.File.GetDownloadTitle(CF.File.SaftyFileName(h.name));

            for (int i = 0; i < h.files.Length; i++)
            {
                Hitomi.HFile file = h.files[i];
                WebClient    wc   = new WebClient();
                wc.Headers.Add("referer", "https://hitomi.la/");
                string folder = Global.config.download_folder.Get <string>();
                if (!File.Exists($"{AppDomain.CurrentDomain.BaseDirectory}/{folder}/{filename}/{i}.jpg"))
                {
                    bool fileen = Global.config.download_file_encrypt.Get <bool>();
                    h.FileInfo.encrypted = fileen;
                    string path = $"{AppDomain.CurrentDomain.BaseDirectory}/{folder}/{filename}/{file.name}.{InternetP.GetDirFromHFileS(file)}.lock";
                    if (fileen)
                    {
                        FileEncrypt.DownloadAsync(wc, new Uri(file.url), path + ".lock");
                    }
                    else
                    {
                        wc.DownloadFileAsync(new Uri(file.url), path);
                    }
                }
            }
        }