Click here to Skip to main content
15,887,343 members
Home / Discussions / C#
   

C#

 
AnswerRe: JSON.Net - Error when I get value from a JToken that could be either a JValue or JArray Pin
onelopez21-Sep-16 4:59
onelopez21-Sep-16 4:59 
GeneralRe: JSON.Net - Error when I get value from a JToken that could be either a JValue or JArray Pin
inquisitive_121-Sep-16 6:11
inquisitive_121-Sep-16 6:11 
AnswerRe: JSON.Net - Error when I get value from a JToken that could be either a JValue or JArray Pin
Nathan Minier21-Sep-16 5:09
professionalNathan Minier21-Sep-16 5:09 
GeneralRe: JSON.Net - Error when I get value from a JToken that could be either a JValue or JArray Pin
inquisitive_121-Sep-16 5:57
inquisitive_121-Sep-16 5:57 
QuestionControl is very similar ComboBox to what's it the name ? Pin
Member 245846720-Sep-16 16:18
Member 245846720-Sep-16 16:18 
AnswerRe: Control is very similar ComboBox to what's it the name ? Pin
BillWoodruff21-Sep-16 3:05
professionalBillWoodruff21-Sep-16 3:05 
QuestionRe: Control is very similar ComboBox to what's it the name ? Pin
ZurdoDev21-Sep-16 3:27
professionalZurdoDev21-Sep-16 3:27 
QuestionFTP Multiple Files With Progress Pin
Kevin Marois20-Sep-16 9:40
professionalKevin Marois20-Sep-16 9:40 
I have this sample FTP code that works fine:
public class SFTP
{
    private string _address = "";
    private string _userName = "";
    private string _password = "";

    public SFTP(string address, string userName, string password)
    {
        _address = address;
        _userName = userName;
        _password = password;
    }

    public void DownloadFile(string localFile, string remoteFile)
    {
        var ftpConnection = GetConnection();
        ftpConnection.DownloadFile(localFile, remoteFile);
    }

    public FTPFile[] GetFileList()
    {
        var ftpConnection = GetConnection();
        FTPFile[] fileDetails = ftpConnection.GetFileInfos();

        return fileDetails;
    }

    public void UploadFile(string localFile, string remoteFile)
    {
        var ftpConnection = GetConnection();
        ftpConnection.UploadFile(localFile, remoteFile);
    }

    private FTPConnection GetConnection()
    {
        FTPConnection ftpConnection = new FTPConnection();
        ftpConnection.ServerAddress = _address;
        ftpConnection.UserName = _userName;
        ftpConnection.Password = _password;
        ftpConnection.ConnectMode = FTPConnectMode.ACTIVE;
        ftpConnection.BytesTransferred += FtpConnection_BytesTransferred;

        try
        {
            ftpConnection.Connect();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            throw;
        }

        return ftpConnection;
    }

    private void FtpConnection_BytesTransferred(object sender, BytesTransferredEventArgs e)
    {
        Console.WriteLine("{0}: {1}", e.RemoteFile, e.ByteCount);
    }
}

Now I want to be able to upload or download multiple files at once and show progress for each. Basically this code needs to run seperetly for each file being uploaded or downloaded. What's the right way to implement this?

Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 20-Sep-16 16:18pm.

AnswerRe: FTP Multiple Files With Progress Pin
Bernhard Hiller20-Sep-16 20:47
Bernhard Hiller20-Sep-16 20:47 
GeneralRe: FTP Multiple Files With Progress Pin
Kevin Marois21-Sep-16 9:13
professionalKevin Marois21-Sep-16 9:13 
GeneralRe: FTP Multiple Files With Progress Pin
Bernhard Hiller21-Sep-16 20:54
Bernhard Hiller21-Sep-16 20:54 
GeneralRe: FTP Multiple Files With Progress Pin
Kevin Marois22-Sep-16 6:07
professionalKevin Marois22-Sep-16 6:07 
AnswerRe: FTP Multiple Files With Progress Pin
Peter_in_278022-Sep-16 15:07
professionalPeter_in_278022-Sep-16 15:07 
SuggestionRe: FTP Multiple Files With Progress Pin
Richard Deeming21-Sep-16 2:51
mveRichard Deeming21-Sep-16 2:51 
GeneralRe: FTP Multiple Files With Progress Pin
Kevin Marois21-Sep-16 9:19
professionalKevin Marois21-Sep-16 9:19 
QuestionIndexOutOfRange Exception When Using Multi Dimensional Array Pin
MadDashCoder20-Sep-16 6:07
MadDashCoder20-Sep-16 6:07 
AnswerRe: IndexOutOfRange Exception When Using Multi Dimensional Array Pin
OriginalGriff20-Sep-16 6:18
mveOriginalGriff20-Sep-16 6:18 
GeneralRe: IndexOutOfRange Exception When Using Multi Dimensional Array Pin
MadDashCoder20-Sep-16 6:40
MadDashCoder20-Sep-16 6:40 
AnswerRe: IndexOutOfRange Exception When Using Multi Dimensional Array Pin
ZurdoDev20-Sep-16 7:40
professionalZurdoDev20-Sep-16 7:40 
GeneralRe: IndexOutOfRange Exception When Using Multi Dimensional Array Pin
OriginalGriff20-Sep-16 8:03
mveOriginalGriff20-Sep-16 8:03 
SuggestionRe: IndexOutOfRange Exception When Using Multi Dimensional Array Pin
Richard Deeming20-Sep-16 8:16
mveRichard Deeming20-Sep-16 8:16 
AnswerRe: IndexOutOfRange Exception When Using Multi Dimensional Array Pin
Gerry Schmitz20-Sep-16 9:15
mveGerry Schmitz20-Sep-16 9:15 
Questionforms and SSO login Pin
V.20-Sep-16 1:19
professionalV.20-Sep-16 1:19 
QuestionSSRS Loop Through Report Datasets and Modify at Runtime Pin
David_4119-Sep-16 9:20
David_4119-Sep-16 9:20 
AnswerRe: SSRS Loop Through Report Datasets and Modify at Runtime Pin
Gerry Schmitz19-Sep-16 10:58
mveGerry Schmitz19-Sep-16 10:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.