Example #1
0
        public static void init()
        {
            NewsConnection connection = new NewsConnection();

            connection.Connect("forums.embarcadero.com");
            connection.Disconnect();
        }
Example #2
0
        private bool downloadArticle()
        {
            string server = txtServer.Text;

            try
            {
                // Temporary connection to the server.
                NewsConnection connection = new NewsConnection();

                connection.Connect(server);

                Newsgroup selectedGroup   = (Newsgroup)lstGroups.SelectedItem;
                Article   selectedArticle = (Article)lstArticleHeaders.SelectedItem;

                connection.GetArticle(selectedGroup, selectedArticle);
                article = selectedArticle.Body;

                connection.Disconnect();

                if (!articleHistory.ContainsKey(selectedArticle))
                {
                    articleHistory.Add(selectedArticle, article);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Download Article", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
Example #3
0
        public static void UpdateArticleText(string server, Newsgroup newsgroup, Article article)
        {
            NewsConnection connection = new NewsConnection();

            connection.Connect(server);
            string articleText = connection.GetArticle(newsgroup, article);

            article.Body = articleText;
        }
Example #4
0
 //ugly overload, fragile, too much duplicated code :(
 public static void UpdateGroupArticles(string server, Newsgroup newsGroup)
 {
     if (newsGroup.Articles == null)
     {
         NewsConnection connection = new NewsConnection();
         connection.Connect(server);
         ArticleCollection articles = connection.GetArticleHeaders(newsGroup);
         connection.Disconnect();
         newsGroup.Articles = articles;
     }
 }
Example #5
0
        //good test server: forums.embarcadero.com.

        public static NewsgroupCollection GetNewsGroups(string server, List <string> includeList, List <string> excludeList)
        {
            NewsConnection connection = new NewsConnection();

            connection.Connect(server);
            NewsgroupCollection groups = connection.GetNewsgroups(includeList, excludeList);

            connection.Disconnect();


            return(groups);
        }
Example #6
0
        private bool downloadGroups()
        {
            string server = txtServer.Text;

            // add an item to the group filter list
            addGroupFilters();

            string[] filterList = cboGroupFilters.Text.Split(' ');

            try
            {
                // Temporary connection to the server.
                NewsConnection connection = new NewsConnection();
                connection.Connect(server);

                if (chkFilterGroups.Checked)
                {
                    if (radInclude.Checked)
                    {
                        groups = connection.GetNewsgroups(filterList, null);
                    }
                    else
                    {
                        groups = connection.GetNewsgroups(null, filterList);
                    }
                }
                else
                {
                    groups = connection.GetNewsgroups();
                }

                connection.Disconnect();

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Download Articles", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
Example #7
0
        private bool downloadArticleHeaders()
        {
            string server = txtServer.Text;

            try
            {
                // Temporary connection to the server.
                NewsConnection connection = new NewsConnection();

                connection.Connect(server);

                Newsgroup selectedGroup = (Newsgroup)lstGroups.SelectedItem;

                if (chkFilterArticles.Checked)
                {
                    int articleLimit;
                    int.TryParse(txtGetNumber.Text, out articleLimit);

                    articleHeaders = connection.GetArticleHeaders(selectedGroup, articleLimit);
                }
                else
                {
                    articleHeaders = connection.GetArticleHeaders(selectedGroup);
                }

                connection.Disconnect();

                if (!groupHistory.ContainsKey(selectedGroup))
                {
                    groupHistory.Add(selectedGroup, articleHeaders);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Download Newsgroups", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
Example #8
0
        private bool downloadArticle()
        {
            string server = txtServer.Text;

            try
            {
                // Temporary connection to the server.
                NewsConnection connection = new NewsConnection();

                connection.Connect(server);

                Newsgroup selectedGroup = (Newsgroup)lstGroups.SelectedItem;
                Article selectedArticle = (Article)lstArticleHeaders.SelectedItem;

                connection.GetArticle(selectedGroup, selectedArticle);
                article = selectedArticle.Body;

                connection.Disconnect();

                if (!articleHistory.ContainsKey(selectedArticle))
                {
                    articleHistory.Add(selectedArticle, article);
                }

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Download Article", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
        }
Example #9
0
        private bool downloadArticleHeaders()
        {
            string server = txtServer.Text;

            try
            {
                // Temporary connection to the server.
                NewsConnection connection = new NewsConnection();

                connection.Connect(server);

                Newsgroup selectedGroup = (Newsgroup)lstGroups.SelectedItem;

                if (chkFilterArticles.Checked)
                {
                    int articleLimit;
                    int.TryParse(txtGetNumber.Text, out articleLimit);

                    articleHeaders = connection.GetArticleHeaders(selectedGroup, articleLimit);
                }
                else
                {
                    articleHeaders = connection.GetArticleHeaders(selectedGroup);
                }

                connection.Disconnect();

                if (!groupHistory.ContainsKey(selectedGroup))
                {
                    groupHistory.Add(selectedGroup, articleHeaders);
                }

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Download Newsgroups", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
        }
Example #10
0
        private bool downloadGroups()
        {
            string server = txtServer.Text;

            // add an item to the group filter list
            addGroupFilters();

            string[] filterList = cboGroupFilters.Text.Split(' ');

            try
            {
                // Temporary connection to the server.
                NewsConnection connection = new NewsConnection();
                connection.Connect(server);

                if (chkFilterGroups.Checked)
                {
                    if (radInclude.Checked)
                    {
                        groups = connection.GetNewsgroups(filterList, null);
                    }
                    else
                    {
                        groups = connection.GetNewsgroups(null, filterList);
                    }
                }
                else
                {
                    groups = connection.GetNewsgroups();
                }

                connection.Disconnect();

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Download Articles", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
        }