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); }
/// <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); } }