Inheritance: RemObjects.InternetPack.CommandBased.SessionEventArgs
		protected override void InvokeOnGetListing(FtpGetListingArgs ea)
		{
			VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
#if DEBUGSERVER
			Debug.Write("Getting Listing for {0}", lSession.CurrentFolder.FullPath);
#endif
			lSession.CurrentFolder.ListFolderItems(ea.Listing);

			base.InvokeOnGetListing(ea);
		}
Example #2
0
 internal protected virtual void InvokeOnGetListing(FtpGetListingArgs e)
 {
     if (this.OnGetListing != null)
         this.OnGetListing(this, e);
 }
Example #3
0
        public static void Cmd_LIST(Object sender, CommandEventArgs e)
        {
            FtpSession lSession = (FtpSession)e.Session;

            if (lSession.State == FtpState.LoggedIn)
            {

                if (lSession.Passive)
                    e.Connection.WriteLine("125 Data connection already open; transfer starting");

                if (!ValidateConnection(lSession))
                {
                    e.Connection.WriteLine("425 Unable to build data connection");
                }
                else
                {
                    FtpGetListingArgs lListingArgs = new FtpGetListingArgs(e.Session, e.Connection, e.Server);
                    if (!lSession.Passive)
                        e.Connection.WriteLine("150 Opening data connection");
                    try
                    {
                        ((FtpServer)e.Server).InvokeOnGetListing(lListingArgs);
                    }
                    catch (FtpException ex)
                    {
                        e.Connection.WriteLine(ex.ToString());
                        return;
                    }

                    for (Int32 i = 0; i < lListingArgs.Listing.Count; i++)
                    {
                        FtpListingItem lItem = lListingArgs.Listing[i];
                        lSession.ActiveConnection.WriteLine(lItem.ToString());
                    }

                    lSession.ActiveConnection.Close();
                    lSession.ActiveConnection = null;

                    try
                    {
                        e.Connection.WriteLine("226 Transfer complete.");
                    }
                    catch
                    {
                        e.Connection.WriteLine("425 Error while transfering");
                    }
                }

                lSession.RestartPoint = 0;
            }
            else
            {
                e.Connection.WriteLine("503 Bad sequence of commands.");
            }
        }