Xceed .NET Libraries Documentation
ParsingListingLine Event (FtpClient)
Example 


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class : ParsingListingLine Event
Raised when a listing line is received from the FTP server.
Syntax
'Declaration
 
Public Event ParsingListingLine As ParsingListingLineEventHandler
'Usage
 
Dim instance As FtpClient

Dim handler As ParsingListingLineEventHandler

 

AddHandler instance.ParsingListingLine, handler
public event ParsingListingLineEventHandler ParsingListingLine
Event Data

The event handler receives an argument of type ParsingListingLineEventArgs containing data related to this event. The following ParsingListingLineEventArgs properties provide information specific to this event.

PropertyDescription
Gets an FtpItemInfo object representing the listing information of an FTP item.  
Gets the listing line which was returned by the FTP server and used to create the Item.  
Gets or sets a boolean value indicating if the listing line returned by the FTP server was valid.  
Remarks

If e.Valid is true when the event is raised, at least one parser succeeded in parsing the listing line and e.Item has been filled with the parsed information. To filter (remove) an item from the listing set e.Valid to false. The content of e.Item can also be modified if you want to change the item's information.

If e.Valid is false when the event is raised, none of the parsers succeeded in parsing the listing line. In this case you can provide your own parsing, fill e.Item and set e.Valid to true.

Calls to the GetFolderContents, SendMultipleFiles and ReceiveMultipleFiles methods will raise this event.

This event is the equivalent of the ParsingListLine event of the ActiveX version of the Xceed FTP Library.

Example
The following example demonstrates how to use the ParsingListingLine event to remove the "." and ".." FTP items from the listing.
Private ftp As New FtpClient()



Private ftp.ParsingListingLine += New ParsingListingLineEventHandler(AddressOf Me.parsing_line)



ftp.Connect("localhost")

ftp.Login()

ftp.GetFolderContents()

ftp.Disconnect()



Private Sub parsing_line(ByVal sender As Object, ByVal e As ParsingListingLineEventArgs)

  If (e.Item.Name = ".") OrElse (e.Item.Name = "..") Then

    e.Valid = False

  Else

    listBox1.Items.Add(e.Item.Name)

  End If

End Sub
FtpClient ftp = new FtpClient();



ftp.ParsingListingLine += new ParsingListingLineEventHandler( this.parsing_line );



ftp.Connect( "localhost" );

ftp.Login();

ftp.GetFolderContents();

ftp.Disconnect();



private void parsing_line( object sender, ParsingListingLineEventArgs e )

{

  if( ( e.Item.Name == "." ) || ( e.Item.Name == ".." ) )

  {

    e.Valid = false;

  }

  else

  {

    listBox1.Items.Add( e.Item.Name );

  }

}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also