Esempio n. 1
0
        /// <summary>
        /// Reload all Directories and Files in Current Directory
        /// </summary>
        private void RefreshDirectory()
        {
            //Clear all items
            lstRemoteSiteFiles.Items.Clear();

            //Open and Display Root Directory
            foreach (FTPfileInfo folder in FtpClient.ListDirectoryDetail(txtRemoteDirectory.Text))
            {
                ListViewItem item = new ListViewItem();
                item.Text = folder.Filename;
                if (folder.FileType == FTPfileInfo.DirectoryEntryTypes.Directory)
                {
                    item.SubItems.Add("Folder");
                }
                else
                {
                    item.SubItems.Add("File");
                }

                item.SubItems.Add(folder.FullName);
                item.SubItems.Add(folder.Permission);
                item.SubItems.Add(folder.FileDateTime.ToShortDateString() + " " + folder.FileDateTime.ToShortTimeString());
                item.SubItems.Add(folder.Size.ToString());
                lstRemoteSiteFiles.Items.Add(item);
            }
        }
Esempio n. 2
0
        public FTPdirectory GetFtpFiles(Uri Host, string ext = "")
        {
            FTPclient ftp = new FTPclient(Host.AbsoluteUri, FtpUser, FtpPassword);

            ftp.UsePassive = true;
            FTPdirectory ftpDir = ftp.ListDirectoryDetail();

            return(ftpDir.GetFiles(""));
        }
Esempio n. 3
0
        /// <summary>
        /// Sets up the FTPClient for this Form.  Called from frmLogin.
        /// </summary>
        /// <param name="client">FTPclient on frmLogin is used to refrence the FtpClient here.</param>
        public void SetFtpClient(Win7FTP.Library.FTPclient client)
        {
            //Set FtpClient
            FtpClient = client;

            //Display the Welcome Message
            Message      = new ListViewItem();
            Message.Text = DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToLongDateString();
            Message.SubItems.Add("Welcome Message");
            Message.SubItems.Add(FtpClient.WelcomeMessage);
            Message.SubItems.Add("No Code");
            Message.SubItems.Add("/");
            lstMessages.Items.Add(Message);

            //Setup OnMessageReceived Event
            FtpClient.OnNewMessageReceived += new FTPclient.NewMessageHandler(FtpClient_OnNewMessageReceived);

            //Open and Display Root Directory and Files/Folders in it
            foreach (FTPfileInfo folder in FtpClient.ListDirectoryDetail("/"))
            {
                ListViewItem item = new ListViewItem();
                item.Text = folder.Filename;
                if (folder.FileType == FTPfileInfo.DirectoryEntryTypes.Directory)
                {
                    item.SubItems.Add("Folder");
                }
                else
                {
                    item.SubItems.Add("File");
                }

                item.SubItems.Add(folder.FullName);
                item.SubItems.Add(folder.Permission);
                item.SubItems.Add(folder.FileDateTime.ToShortDateString() + " " + folder.FileDateTime.ToShortTimeString());
                item.SubItems.Add(GetFileSize(folder.Size));
                lstRemoteSiteFiles.Items.Add(item);
            }
        }