Esempio n. 1
0
 override internal void OnNewResponseLine(FtpResponse ctx, FtpResponseLine line)
 {
     if (FtpResponseLineType.Single == line.Type)
     {
         if (line.Code != ctx.Code)                //first code and the last should be the equal
         {
             ctx.ChangeState(new FtpResponseFormatError());
             //throw new FtpResponseFormatException("First and last line reply codes is not equals.", ctx.CurrentLineNumber);
             throw new FtpProtocolException("First and last line response's codes are not equals.", null, -1, -1);
         }
         else
         {
             ctx.ChangeState(new FtpResponseCompleted());
         }
     }
     else if (FtpResponseLineType.Intermediate == line.Type)
     {
         //noop
     }
     else if (FtpResponseLineType.First == line.Type)
     {
         //noop
     }
     else
     {
         ctx.ChangeState(new FtpResponseFormatError());
         throw new FtpProtocolException("Unexpected response line received.", null, -1, -1);
     }
 }
Esempio n. 2
0
 override internal void OnNewResponseLine(FtpResponse ctx, FtpResponseLine line)
 {
     if (FtpResponseLineType.Single == line.Type)
     {
         ctx.ChangeState(new FtpResponseCompleted());
     }
     else if (FtpResponseLineType.First == line.Type)
     {
         ctx.ChangeState(new FtpResponseIntermediate());
     }
     else
     {
         ctx.ChangeState(new FtpResponseFormatError());
         throw new FtpProtocolException("Unexpected response line received.", null, -1, -1);
         //throw new FtpResponseFormatException("Unexpected respone line received.", ctx.CurrentLineNumber);
     }
 }