Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 12-04-2010
Avatar de matabyte
matabyte matabyte is offline
Miembro
 
Registrado: ene 2008
Ubicación: Kyoto, Japon
Posts: 177
Poder: 19
matabyte Va por buen camino
Vale, ya lo he conseguido, pongo la solución por si alguien necesita también algo parecido:

La estructura que contiene la lista de directorios es:

Código Delphi [-]
 type
  Tdirectorio = record
    nombre: widestring;
    path:widestring;
    anterior: longword;
    path_completo: widestring;
  end;

var
iso_for:record
             tabla_path:array of Tdirectorio;
             tabla_path_num:longword;
             num_directoriosANSI: longword;
             directoriosANSI: array of Tdirectorio;
          end;

Y la solución para extraterlo:

Código Delphi [-]
     ISO_for.tabla_path_num:=1;
     setlength(ISO_for.tabla_path,ISO_for.tabla_path_num);
     ISO_for.tabla_path[ISO_for.tabla_path_num-1].anterior:=1;
     ISO_for.tabla_path[ISO_for.tabla_path_num-1].path_completo:='\';
     ISO_for.tabla_path[ISO_for.tabla_path_num-1].nombre:='\';

      for a := 0 to iso_for.num_directoriosANSI - 1 do
       begin
         st:=iso_for.directoriosANSI[a].nombre;
         if st[1]<>'\' then st:='\'+st;
         st2:='';
         for b := length(st) downto 1 do
          begin
            if (st[b]='\') then
             begin
               st2:=Copy(st, 0, b);
               result:=false;
               for c := 0 to ISO_for.tabla_path_num - 1 do
                begin
                  if uppercase(st2)=uppercase(ISO_for.tabla_path[c].path_completo) then
                   begin
                     result:=true;
                     break;
                   end;
                end;
                  if result then
                  else
                   begin
                     inc(ISO_for.tabla_path_num);
                     setlength(ISO_for.tabla_path,ISO_for.tabla_path_num);
                     ISO_for.tabla_path[ISO_for.tabla_path_num-1].path_completo:=st2;
                     for c := length(st2) downto 0 do
                      begin
                        if ((st2[c]='\')and(c<>Length(st2)))or(c=0) then
                         begin
                           if c=0 then
                            begin
                             ISO_for.tabla_path[ISO_for.tabla_path_num-1].anterior:=1;
                             ISO_for.tabla_path[ISO_for.tabla_path_num-1].nombre:=copy(st2,c,Length(st2));
                            end
                           else
                            begin
                             ISO_for.tabla_path[ISO_for.tabla_path_num-1].nombre:=copy(st2,c+1,Length(st2));
                            end;
                           break;
                         end;
                      end;
                   end;
               st2:=st2+'\';
             end;
          end;
       end;


      for b := 1 to ISO_for.tabla_path_num - 1 do
       begin
         //Caculamos el hijo
         st2:=iso_for.tabla_path[b].path_completo;
                     for c := length(st2) downto 0 do
                      begin
                        if ((st2[c]='\')and(c<>Length(st2)))or(c=0) then
                         begin
                           if c=0 then
                            begin
                              iso_for.tabla_path[b].anterior:=1;
                            end
                           else
                            begin
                              st2:=Copy(st2,0,c);
                              for a := 0 to ISO_for.tabla_path_num - 1 do
                               begin
                                 if UpperCase(st2)=UpperCase(iso_for.tabla_path[a].path_completo) then
                                  begin
                                    iso_for.tabla_path[b].anterior:=a;
                                    Break;
                                  end;
                               end;
                            end;
                           break;
                         end;
                      end;
//         richedit1.Lines.Add(iso_for.tabla_path[iso_for.tabla_path[b].anterior].nombre+'  --  '+iso_for.tabla_path[b].nombre);
       end;
__________________
Donde Trabajo ahora --> http://cct-inc.co.jp/
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Confirma ADN que bebé blanco es hijo de padres negros JXJ La Taberna 13 20-01-2009 08:00:24
Felicidades a todos los Padres.... BlueSteel La Taberna 12 16-06-2008 03:00:41
...en homenaje a sus padres que llegaron de Burdeos marcoszorrilla La Taberna 0 19-12-2006 08:56:54
Formulario MDI e Hijos chux OOP 7 07-12-2005 21:19:14
...14 hijos... Jure Humor 0 18-08-2004 00:55:03


La franja horaria es GMT +2. Ahora son las 12:38:38.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi