private void CargarImagenes(string codigo) { imageSlider1.Images.Clear(); ListaImagenes.Clear(); Chilkat.Ftp2 ftp = new Chilkat.Ftp2(); bool success; //success= ftp.UnlockComponent("CRNsu3.CB10699_Zu6BhW7yjEkG"); //if (success != true) //{ // Console.WriteLine(ftp.LastErrorText); // return; //} ftp.Hostname = "www.repuestosdemoviles.es"; ftp.Username = "******"; ftp.Password = "******"; success = ftp.Connect(); if (success != true) { Console.WriteLine(ftp.LastErrorText); return; } string cwd = "httpdocs/ebay/imagenes/" + codigo.Trim(); string BaseUrl = "http://www.repuestosdemoviles.es/ebay/imagenes/" + codigo.Trim(); success = ftp.ChangeRemoteDir(cwd); int i; int n; int NumeroFotos = 0; n = ftp.GetDirCount(); if (n > 0) { for (i = 0; i <= n - 1; i++) { if (ftp.GetIsDirectory(i) == false) { WebClient wc = new WebClient(); string filename = BaseUrl + "/" + ftp.GetFilename(i); byte[] bytes = wc.DownloadData(filename); MemoryStream ms = new MemoryStream(bytes); imageSlider1.Images.Add(Image.FromStream(ms)); ListaImagenes.Add(ftp.GetFilename(i)); NumeroFotos++; } } } success = ftp.Disconnect(); textEditNumeroImagenes.Text = NumeroFotos.ToString(); }