示例#1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        public static List <alfaItem> Step02_FTP_GetFileNames()
        {
            // Break
            if (!alfaSAM.IsRunning)
            {
                throw new Exception(alfaSAM.BreakMessage);
            }

            // Start
            DateTime p_Start = DateTime.Now;

            // Log
            alfaLog.Add("(FTP) Server = " + alfaSAM.m_FtpAdd1 + alfaSAM.m_FtpPath);
            alfaLog.Add("(FTP) Getting FileNames ... [ Start ]");

            // FTP
            Rebex.Net.Ftp ftp = alfaFtp.Get();

            // File Names
            string[] p_FileList = ftp.GetNameList();

            // Create List
            List <alfaItem> p_ItemList = new List <alfaItem>();

            // Index
            int p_Index = 0;

            foreach (string p_File in p_FileList)
            {
                // Inc Index
                p_Index = p_Index + 1;

                // FileName
                string p_FileName = string.Format("[{0:000}]  {1}  ( {2} Bytes )", p_Index, p_File, ftp.GetFileLength(p_File));

                // Add to List
                p_ItemList.Add(new alfaItem(p_FileName, p_File));
            }

            // Log
            alfaLog.Add("(FTP) Getting FileNames ...", alfaDate.GetSec(p_Start));

            // Return
            return(p_ItemList);
        }