Unfortunately, without seeing the code, anything I recommend will be theoretical. Can you attach the function or class files?
If I understand this correctly, the GetFileList function returns a single string containing a comma-separated list of file names (eg, "file1,file2, file3,file4"). If this is the case, then just add the loop. I'll use a separate function for easy reading...
// This main function will get the list of names, create the loop, and then call the original Downlod function
public void downloadAll()
{
// Get the list of file names from the server
string nameList = GetFileList("*");
// Get file string into the names array
string[] fileNames = nameList.Split(char.Parse(","));
foreach ( string name in file Names )
{
// Add logic here to create the local name.
string localName = "C:\\" + name.ToString().Trim();
download(name.ToString().Trim(), localName, true);
}
}
// The original download function
public void download(string remFileName, string locFileName, Boolean resume)
{
if(!logined)
{
login();
}
setBinaryMode(true);
Console.WriteLine("Downloading file " +
remFileName + " from " + remoteHost +
"/" + remotePath);
if (locFileName.Equals(""))
{
locFileName = remFileName;
}
if(!File.Exists(remFileName))
{
Stream st = File.Create(mess);
st.Close();
}
}