public bool MangaIllustMultiDownload(nicomangaimageinfo[] Nicomanga,string[] name,string path,string format) { int i, j; int infomax = Nicomanga.Length; int imagemax; bool flag; string url, savename; System.Net.WebClient wc = new System.Net.WebClient(); try { for (i = 0; i < infomax; i++) { savename = PdfClass.PdfFileNameConverter(name[i]); System.IO.Directory.CreateDirectory(path + "\\" + savename); imagemax = Nicomanga[i].image_count; for (j = 0; j < imagemax; j++) { url = "http://lohas.nicoseiga.jp/thumb/" + Nicomanga[i].imageinfo[j].id + "p?"; wc.DownloadFile(url, @path + "\\" + savename + "\\" + j + "." + format); } } flag = true; } catch { flag = false; for (i = 0; i < infomax; i++) { savename = PdfClass.PdfFileNameConverter(name[i]); if (System.IO.Directory.Exists(path + "\\" + savename[i])) { System.IO.Directory.Delete(path + "\\" + savename[i]); } } } wc.Dispose(); return flag; }
public bool MangaIllustDownload(nicomangaimageinfo Nicomanga,string savename,string path,string format) { int i,imagemax; string url; bool flag; System.Net.WebClient wc = new System.Net.WebClient(); savename = PdfClass.PdfFileNameConverter(savename); System.IO.Directory.CreateDirectory(path+"\\"+savename); imagemax = Nicomanga.image_count; try { for (i = 0; i < imagemax; i++) { url = "http://lohas.nicoseiga.jp/thumb/" + Nicomanga.imageinfo[i].id + "p?"; wc.DownloadFile(url, @path + "\\" + savename + "\\" + i + "." + format); } flag = true; } catch { flag = false; if (System.IO.Directory.Exists(path + "\\" + savename)) { System.IO.Directory.Delete(path + "\\" + savename); } } wc.Dispose(); return flag; }
public void MangaIllustInfoGet(string id) { id = id.Replace("mg", ""); string url = "http://seiga.nicovideo.jp/api/theme/data?theme_id=" + id; this.mangaimageinfo = new nicomangaimageinfo(); try { XmlDocument xml = this.NicoLoginGetXml(url); this.mangaimageinfo.flag = true; this.mangaimageinfo.id = id; this.mangaimageinfo.image_count = int.Parse(xml.SelectNodes("/response/image_count")[0].InnerText); int max = this.mangaimageinfo.image_count; this.mangaimageinfo.imageinfo=new nicomangaimageinfos[max]; for (int i = 0; i < max; i++) { this.mangaimageinfo.imageinfo[i]=new nicomangaimageinfos(); this.mangaimageinfo.imageinfo[i].id = xml.SelectNodes("/response/image_list/image/id")[i].InnerText; this.mangaimageinfo.imageinfo[i].url = xml.SelectNodes("/response/image_list/image/source_url")[i].InnerText; } } catch { this.mangaimageinfo.flag = false; } }