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); }
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 = ""; } }