Beispiel #1
0
        private void ScanThread()
        {
            lock (threadLock)
            {
                //Removes 404'd threads
                foreach (Imageboard imB in ListThreads.ToArray())
                {
                    if (imB.isGone())
                    {
                        ListThreads.Remove(imB);
                        updateDataSource(typeURL.thread);

                        if (Properties.Settings.Default.saveOnClose)
                        {
                            General.WriteURLs(ListBoards, ListThreads);
                        }
                    }
                }
            }

            lock (boardLock)
            {
                //Searches for new threads on the watched boards
                foreach (Imageboard imB in ListBoards)
                {
                    string[] Threads = { };
                    try
                    {
                        Threads = imB.getThreads();
                    }
                    catch
                    {
                    }
                    finally
                    {
                        foreach (string thread in Threads)
                        {
                            Imageboard newImageboard = General.CreateNewImageboard(thread);
                            if (newImageboard != null && isUnique(newImageboard.getURL(), ListThreads))
                            {
                                AddURLToList(newImageboard);
                            }
                        }
                    }
                }
            }

            lock (threadLock)
            {
                //Download threads
                foreach (Imageboard imB in ListThreads)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(imB.download));
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Application domain exception handler
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">event</param>
 public static void AppDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e)
 {
     Properties.Settings.Default.saveOnClose = true;
     Properties.Settings.Default.Save();
     try
     {
         General.WriteURLs(MainFrame.ListBoards, MainFrame.ListThreads);
     }
     catch (Exception eX)
     {
         MessageBox.Show(eX.Message);
     }
 }
Beispiel #3
0
        private void AddUrl(string url)
        {
            if (string.IsNullOrWhiteSpace(url) && Clipboard.ContainsText())
            {
                url = Clipboard.GetText();
            }

            Imageboard newImageboard = General.CreateNewImageboard(url);

            if (newImageboard != null)
            {
                if (isUnique(newImageboard.getURL(), newImageboard.isBoard() ? ListBoards : ListThreads))
                {
                    AddURLToList(newImageboard);

                    if (!scnTimer.Enabled)
                    {
                        scnTimer.Enabled = true;
                    }
                    if (Properties.Settings.Default.saveOnClose)
                    {
                        General.WriteURLs(ListBoards, ListThreads);
                    }

                    scan(this, new EventArgs());
                }
                else
                {
                    DialogResult result = MessageBox.Show("URL is already in queue!\nOpen corresponding folder?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (result == DialogResult.Yes)
                    {
                        string spath = newImageboard.getPath();
                        if (!Directory.Exists(spath))
                        {
                            Directory.CreateDirectory(spath);
                        }
                        Process.Start(spath);
                    }
                }
            }
            else
            {
                MessageBox.Show("Corrupt URL, unsupported website or not a board/thread!");
                edtURL.Text = "";
            }
        }
Beispiel #4
0
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = DialogResult.OK;

            if (Properties.Settings.Default.warnOnClose && ListThreads.Count > 0)
            {
                CloseWarn clw = new CloseWarn();
                result   = clw.ShowDialog();
                e.Cancel = (result == DialogResult.Cancel);
            }

            if (result == DialogResult.OK)
            {
                nfTray.Visible = false;
                nfTray.Dispose();
                scnTimer.Enabled = false;

                if (Properties.Settings.Default.saveOnClose)
                {
                    General.WriteURLs(ListBoards, ListThreads);
                }
            }
        }
Beispiel #5
0
        private void btnClearAll_Click(object sender, EventArgs e)
        {
            if (tcApp.SelectedIndex > 1)
            {
                return;
            }
            bool board = (tcApp.SelectedIndex == 1);                             // Board Tab is open -> board=true; Thread tab -> board=false

            string type = "threads";

            if (board)
            {
                type = "boards";
            }

            DialogResult dialogResult = MessageBox.Show("Are you sure you want to clear all " + type + "?", "Clear all " + type,
                                                        MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); // confirmation prompt

            if (dialogResult == DialogResult.Yes)
            {
                if (board)
                {
                    ListBoards.Clear();
                    updateDataSource(typeURL.board);
                }
                else
                {
                    ListThreads.Clear();
                    updateDataSource(typeURL.thread);
                }

                if (Properties.Settings.Default.saveOnClose)
                {
                    General.WriteURLs(ListBoards, ListThreads);
                }
            }
        }