コード例 #1
0
        public static NntpConnection GetNntpConnection([NotNull] TypedNntpForum nntpForum)
        {
            CodeContracts.VerifyNotNull(nntpForum, "nntpForum");

            var nntpConnection = new NntpConnection();

            // call connect server
            nntpConnection.ConnectServer(nntpForum.Address.ToLower(), nntpForum.Port ?? 119);

            // provide authentication if required...
            if (nntpForum.UserName.IsSet() && nntpForum.UserPass.IsSet())
            {
                nntpConnection.ProvideIdentity(nntpForum.UserName, nntpForum.UserPass);
                nntpConnection.SendIdentity();
            }

            return(nntpConnection);
        }
コード例 #2
0
        public static NntpConnection GetNntpConnection([NotNull] Tuple <NntpForum, NntpServer, Forum> nntpForum)
        {
            CodeContracts.VerifyNotNull(nntpForum, "nntpForum");

            var nntpConnection = new NntpConnection();

            // call connect server
            nntpConnection.ConnectServer(nntpForum.Item2.Address.ToLower(), nntpForum.Item2.Port ?? 119);

            // provide authentication if required...
            if (!nntpForum.Item2.UserName.IsSet() || !nntpForum.Item2.UserPass.IsSet())
            {
                return(nntpConnection);
            }

            nntpConnection.ProvideIdentity(nntpForum.Item2.UserName, nntpForum.Item2.UserPass);
            nntpConnection.SendIdentity();

            return(nntpConnection);
        }
コード例 #3
0
ファイル: YafNntp.cs プロジェクト: vzrus/VZF
    public static NntpConnection GetNntpConnection([NotNull] TypedNntpForum nntpForum)
    {
      CodeContracts.ArgumentNotNull(nntpForum, "nntpForum");

      var nntpConnection = new NntpConnection();

      // call connect server
      nntpConnection.ConnectServer(nntpForum.Address.ToLower(), nntpForum.Port ?? 119);
      
      // provide authentication if required...
      if (nntpForum.UserName.IsSet() && nntpForum.UserPass.IsSet())
      {
        nntpConnection.ProvideIdentity(nntpForum.UserName, nntpForum.UserPass);
        nntpConnection.SendIdentity();
      }

      return nntpConnection;
    }