Ver Mensaje Individual
  #6  
Antiguo 08-05-2011
chuli17 chuli17 is offline
Miembro
NULL
 
Registrado: feb 2011
Posts: 11
Reputación: 0
chuli17 Va por buen camino
Ya e sacado el fallo, asi quedo el codigo




Código Delphi [-]
if Copy(Date, 1, 14) = 'LISTARARCHIVOS' then
begin
Delete(Date, 1, 15); //Borra 'LISTARARCHIVOS|'
Newl := ListView1.FindCaption(0,Inttostr(Socket.SocketHandle),False,True,False); //Buscamos la conexión
if Newl <> nil then
begin
Form2.ListViewArchivos.Items.BeginUpdate;
(Newl.SubItems.Objects[0] as TForm2).ListViewArchivos.Clear; //Limpia primero...
if Length((Newl.SubItems.Objects[0] as TForm2).Edit1.Text) > 3 then
begin
Newl.ImageIndex := 0;
(Newl.SubItems.Objects[0] as TForm2).ListViewArchivos.Items.Add.Caption := '<..>';
end;
while Pos('|', Date) > 1 do
begin
TempStr := Copy(Date, 1, (Pos('|', Date) - 1));
Delete(Date, 1, Pos('|', Date)); //Borra lo que acaba de copiar
if TempStr[1] = #2 then //entonces le llegó una carpeta
begin
Newl := ListView1.FindCaption(0,Inttostr(Socket.SocketHandle),False,True,False); //Buscamos la conexión
if Newl <> nil then
Delete(TempStr, 1, 1); //borra el #2
Newl := (Newl.SubItems.Objects[0] as TForm2).ListViewArchivos.Items.Add;
Newl.ImageIndex := 1; //1 es el icono de carpeta cerrada
Newl.Caption := TempStr;
Newl.SubItems.Add('');
Newl.SubItems.Add('Carpeta de archivos');
Newl.SubItems.Add('');
end
else //entonces es un archivo, saque tambien la información extra...
begin
Newl := ListView1.FindCaption(0,Inttostr(Socket.SocketHandle),False,True,False); //Buscamos la conexión
if Newl <> nil then
Newl := (Newl.SubItems.Objects[0] as TForm2).ListViewArchivos.Items.Add;
Newl.ImageIndex := 2;
Newl.Caption := TempStr;
TempStr := (Copy(Date, 1, (Pos('|', Date) - 1)));
Delete(Date, 1, Pos('|', Date)); //Borra lo que acaba de copiar
Newl.SubItems.Add(TempStr + 'Kb'); //agrega el tamaño
TempStr := (Copy(Date, 1, (Pos('|', Date) - 1)));
Delete(Date, 1, Pos('|', Date)); //Borra lo que acaba de copiar
Newl.SubItems.Add(TempStr); //agrega el tipo
TempStr := (Copy(Date, 1, (Pos('|', Date) - 1)));
Delete(Date, 1, Pos('|', Date)); //Borra lo que acaba de copiar
Newl.SubItems.Add(TempStr); //agrega la fecha
end;
end;
end;
end;



lo dejo por si a alguien le puede sevir como ejemplo. Ya podeis cerrar el post si quereis. Gracias.

Última edición por chuli17 fecha: 08-05-2011 a las 23:59:36.
Responder Con Cita