Пример #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 (General.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 (Exception exep)
                    {
                    }
                    foreach (string thread in Threads)
                    {
                        Imageboard newImageboard = General.createNewIMB(thread, false);
                        if (newImageboard != null && isUnique(newImageboard.getURL(), ListThreads))
                        {
                            lock (threadLock)
                            {
                                ListThreads.Add(newImageboard);
                                updateDataSource(typeURL.thread);
                            }
                        }
                    }
                }
            }

            lock (threadLock)
            {
                //Download threads
                foreach (Imageboard imB in ListThreads)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(imB.download));
                }
            }
        }
Пример #2
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));
                }
            }
        }