public bool AddNewThread(ThreadInfo Info) { if (Chans.SupportedChan(Info.ThreadURL) && !ThreadURLs.Contains(Info.ThreadURL)) { frmDownloader newThread = new frmDownloader(); newThread.Name = Info.ThreadURL; newThread.CurrentThread = Info; newThread.Show(); newThread.Hide(); ListViewItem lvi = new ListViewItem(); lvi.Name = Info.ThreadURL; lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.ImageIndex = (int)Info.Chan; lvi.SubItems[clStatus.Index].Text = "Creating"; lvi.SubItems[clThread.Index].Text = "/" + Info.ThreadBoard + "/ - " + Info.ThreadID; lvThreads.Items.Add(lvi); newThread.Opacity = 100; newThread.ShowInTaskbar = true; ThreadURLs.Add(Info.ThreadURL); Threads.Add(newThread); if (Info.SetCustomName) { lvi.SubItems[clName.Index].Text = Info.CustomName; } else { if (Info.RetrievedThreadName) { lvi.SubItems[clName.Index].Text = Info.ThreadName; } else { lvi.SubItems[clName.Index].Text = Info.ThreadURL; } } newThread.ManageThread(ThreadEvent.StartDownload); return(true); } return(false); }
public static string GetHTMLBase(ChanType Chan, ThreadInfo Info) { switch (Chan) { case ChanType.FourChan: string HTMLBase = "<!DOCTYPE html>\r\n<html>\r\n<head>\r\n<meta charset=\"utf-8\">\r\n" + "<style> html { -moz-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } body { background: #1d1f21 none; color: #c5c8c6; font-family: arial, helvetica, sans-serif; font-size: 10pt; margin-left: 0; margin-right: 0; margin-top: 5px; padding-left: 5px; padding-right: 5px; } .CenteredSmall { width: 468px; max-width: 100%; } a, a:visited { color: #81a2be!important; text-decoration: none; } a.replylink:not(:hover), div#absbot a:not(:hover) { color: #81a2be!important; } a:hover { color: #5f89ac!important; } img { border: none; } hr { border: none; border-top: 1px solid #282a2e; height: 0; } div.boardBanner { text-align: center; clear: both; } div.boardBanner>div.boardTitle { font-family: Tahoma, sans-serif; font-size: 28px; font-weight: 700; letter-spacing: -2px; margin-top: 0; } div.boardBanner>div.boardSubtitle { font-size: x-small; } div.post { margin: 5px 0; overflow: hidden; } div.op { display: inline; } div.reply { background-color: #282a2e; border: 1px solid #282a2e; display: table; padding: 2px; } div.post div.postInfo span.nameBlock span.postertrip { color: #c5c8c6; font-weight: 400!important; } div.post div.file .fileThumb { float: left; margin-left: 20px; margin-right: 20px; margin-top: 3px; margin-bottom: 5px; } span.fileThumb { margin-left: 0!important; margin-right: 5px!important; } div.post div.file .fileThumb img { border: none; float: left; } .postblock { background-color: #282a2e; color: #c5c8c6; font-weight: 700; padding: 0 5px; font-size: 10pt; } .reply:target { background: #1d1d21!important; border: 1px solid #111!important; padding: 2px; } .deadlink { text-decoration: line-through; color: #81a2be!important; } .oldpost { color: #c5c8c6; font-weight: 700; } .fileText a { text-decoration: underline; } span.subject{ color:#b294bb;font-weight:700; } </style>\r\n" + "<title></title>\r\n" + "</head>\r\n\r\n<body>\r\n<div class=\"boardBanner\">\r\n<div class=\"boardTitle\">" + Info.ThreadBoard + " - " + Info.BoardName + "</div>\r\n<div class=\"boardSubtitle\">" + BoardSubtitles.GetSubtitle(Chan, Info.ThreadBoard) + "</div>\r\n</div>" + "<hr class=\"CenteredSmall\">"; return(HTMLBase); default: return(null); } }
/// <summary> /// Adds a new thread to the queue via saved threads. /// </summary> /// <param name="Info"></param> /// <returns></returns> public bool AddNewThread(SavedThreadInfo Info) { if (Chans.SupportedChan(Info.ThreadURL) && !ThreadURLs.Contains(Info.ThreadURL)) { frmDownloader newThread = new frmDownloader(); ThreadInfo NewInfo = new ThreadInfo(); NewInfo.Chan = Chans.GetChanType(Info.ThreadURL); switch (NewInfo.Chan) { case ChanType.None: newThread.Dispose(); return(false); } newThread.Name = Info.ThreadURL; NewInfo.ThreadURL = Info.ThreadURL; NewInfo.RetrievedThreadName = Info.RetrievedThreadName; NewInfo.ThreadName = Info.ThreadName; NewInfo.SetCustomName = Info.SetCustomName; NewInfo.CustomName = Info.CustomName; newThread.CurrentThread = NewInfo; newThread.ManageThread(ThreadEvent.ParseForInfo); newThread.Show(); newThread.Hide(); ListViewItem lvi = new ListViewItem(); lvi.Name = Info.ThreadURL; lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.ImageIndex = (int)NewInfo.Chan; lvi.SubItems[clStatus.Index].Text = "Creating"; lvi.SubItems[clThread.Index].Text = "/" + NewInfo.ThreadBoard + "/ - " + NewInfo.ThreadID; lvThreads.Items.Add(lvi); newThread.Opacity = 100; newThread.ShowInTaskbar = true; ThreadURLs.Add(Info.ThreadURL); NewInfo.OverallStatus = ThreadStatus.ThreadIsAlive; Threads.Add(newThread); if (Info.SetCustomName) { lvi.SubItems[clName.Index].Text = Info.CustomName; newThread.CurrentThread.SetCustomName = true; } else { if (Info.RetrievedThreadName) { lvi.SubItems[clName.Index].Text = Info.ThreadName; } else { lvi.SubItems[clName.Index].Text = Info.ThreadURL; } } newThread.ManageThread(ThreadEvent.StartDownload); return(true); } return(false); }
/// <summary> /// Adds a new thread to the queue via URL. /// </summary> /// <param name="ThreadURL">The url of the thread that will be added to the queue.</param> /// <returns>Boolean based on it's success</returns> public bool AddNewThread(string ThreadURL) { if (ThreadURL.StartsWith("view-source:")) { ThreadURL = ThreadURL.Substring(12); } if (Chans.SupportedChan(ThreadURL)) { if (ThreadURLs.Contains(ThreadURL)) { int ThreadURLIndex = ThreadURLs.IndexOf(ThreadURL); if (Threads[ThreadURLIndex].CurrentThread.OverallStatus != ThreadStatus.ThreadIsAlive) { Threads[ThreadURLIndex].ManageThread(ThreadEvent.RetryDownload); } return(true); } else { frmDownloader newThread = new frmDownloader(); ThreadInfo NewInfo = new ThreadInfo(); NewInfo.Chan = Chans.GetChanType(ThreadURL); switch (NewInfo.Chan) { case ChanType.fchan: if (!Downloads.Default.fchanWarning) { MessageBox.Show( "fchan works, but isn't supported. I'm keeping this in for people, but here's your only warning: I will not help with any issues regarding fchan, and they will not be acknowledged.\n\n" + "The reason I'm not going to continue working on fchan is because of all the logic shenanigans I have to do to get files, and even then it's still not perfect for some files.\n\n\n" + "I might fix it and update it later, but I'm not going to touch it anymore. You're on your own with it.\n\n" + "This is the only time this warning will appear."); Downloads.Default.fchanWarning = true; Downloads.Default.Save(); } break; case ChanType.None: newThread.Dispose(); return(false); } newThread.Name = ThreadURL; NewInfo.ThreadURL = ThreadURL; NewInfo.OverallStatus = ThreadStatus.ThreadIsAlive; newThread.CurrentThread = NewInfo; newThread.ManageThread(ThreadEvent.ParseForInfo); newThread.Show(); ListViewItem lvi = new ListViewItem(); lvi.Name = ThreadURL; lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new ListViewItem.ListViewSubItem()); lvi.ImageIndex = (int)NewInfo.Chan; lvi.SubItems[clStatus.Index].Text = "Creating"; lvi.SubItems[clThread.Index].Text = "/" + NewInfo.ThreadBoard + "/ - " + NewInfo.ThreadID; lvi.SubItems[clName.Index].Text = ThreadURL; lvThreads.Items.Add(lvi); ThreadURLs.Add(ThreadURL); Threads.Add(newThread); if (chkCreateThreadInTheBackground.Checked) { newThread.Hide(); } newThread.Opacity = 100; newThread.ShowInTaskbar = true; newThread.ManageThread(ThreadEvent.StartDownload); ThreadsModified = true; return(true); } } else { return(false); } }