예제 #1
0
        private bool AddURLToList(Imageboard imageboard)
        {
            if (imageboard == null)
            {
                return(false);
            }

            if (imageboard.isBoard())
            {
                lock (boardLock)
                {
                    ListBoards.Add(imageboard);
                    updateDataSource(typeURL.board);
                }
            }
            else
            {
                lock (threadLock)
                {
                    ListThreads.Add(imageboard);
                    updateDataSource(typeURL.thread);
                }
            }

            return(true);
        }
예제 #2
0
파일: Main.cs 프로젝트: MistressAshai/YChan
        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 = "";
            }
        }