Exemple #1
0
        private void Initialize()
        {
            m_NNTP = new NNTPClient();
            m_NNTP.OnReceivedArticleLine += new NZB_O_Matic.NNTPClient.OnReceivedArticleLineDelegate(DownloadProgress);
            m_NNTP.SendTimeout            = 60000;
            m_NNTP.ReceiveTimeout         = 60000;
            try
            {
                m_Status = "Connecting...";
                m_NNTP.Connect(m_Hostname, m_Port);

                if (m_RequiresLogin)
                {
                    m_Status = "Authenticating...";
                    if (m_NNTP != null)
                    {
                        m_NNTP.AuthenticateUser(m_Username, m_Password);
                    }
                }
            }
            catch (Exception e)
            {
                Global.ConnectionLog.LogLine("{0}|E|{1}|{2}", System.Threading.Thread.CurrentThread.Name, e.Message, e.ToString());

                m_Status = "Error: " + e.Message;

                try
                {
                    m_NNTP.Close();
                }
                catch
                {
                }

                m_Connected = false;
                m_Failed    = true;
                return;
            }

            try
            {
                m_NNTP.SetMode(NNTPClient.Mode.MODE_READER);
            }
            catch (Exception e)
            {
                Global.ConnectionLog.LogLine("{0}|E|{1}|{2}", System.Threading.Thread.CurrentThread.Name, e.Message, e.ToString());
            }

            Handler();
        }
        private void Initialize()
        {
            m_NNTP = new NNTPClient();
            m_NNTP.OnReceivedArticleLine += new NZB_O_Matic.NNTPClient.OnReceivedArticleLineDelegate(DownloadProgress);
            m_NNTP.SendTimeout = 60000;
            m_NNTP.ReceiveTimeout = 60000;
            try
            {
                m_Status = "Connecting...";
                m_NNTP.Connect( m_Hostname, m_Port);

                if(m_RequiresLogin)
                {
                    m_Status = "Authenticating...";
                    if(m_NNTP != null)
                        m_NNTP.AuthenticateUser( m_Username, m_Password);
                }
            }
            catch(Exception e)
            {
                Global.ConnectionLog.LogLine( "{0}|E|{1}|{2}", System.Threading.Thread.CurrentThread.Name, e.Message, e.ToString());

                m_Status = "Error: " + e.Message;

                try
                {
                    m_NNTP.Close();
                }
                catch
                {
                }

                m_Connected = false;
                m_Failed = true;
                return;
            }

            try
            {
                m_NNTP.SetMode(NNTPClient.Mode.MODE_READER);
            }
            catch(Exception e)
            {
                Global.ConnectionLog.LogLine( "{0}|E|{1}|{2}", System.Threading.Thread.CurrentThread.Name, e.Message, e.ToString());
            }

            Handler();
        }