Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 07-05-2014
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
elmago00,

Cita:
Empezado por elmago00
...al fin lo conseguí...


Una pequeña corrección :
Código Delphi [-]
procedure TForm1.DumpFile(aFileName:TFileName; SG: TStringGrid; const BPF: Word);
var
  c, i, r, b : Integer;
  Ascii: String;
  Aux: Byte;
  Col : Integer;

begin

  with TMemoryStream.Create do
  try

    LoadFromFile(aFileName);

    Caption:= Format('FileName = %s , FileSize = %d Bytes', [aFileName, Size]);

    // Configurar StringGrid

    SG.ShowHeader := False;
    SG.ShowHorzLines := False;
    SG.ShowVertLines := False;

    for i := 1 to BPF + 2 do
       SG.AddObject(TStringColumn.Create(nil));

    SG.RowCount := (Size div BPF) + 1;
    if (Size Mod BPF) <> 0 then
       SG.RowCount := SG.RowCount + 1;

    for Col := 0 to SG.ColumnCount - 1 do
    begin

        if (Col = 0) then
           SG.Columns[Col].Width := 80;

        if (Col <> SG.ColumnCount - 1) and (Col <> 0) then
           SG.Columns[Col].Width := 30;

        if (Col = SG.ColumnCount - 1) then
           SG.Columns[Col].Width := SG.Canvas.TextWidth('X') * BPF;

    end;

    SG.Cells[0,0]:= 'Offset(h)';
    SG.Cells[SG.ColumnCount-1,0]:= 'ASCII';

    for i:= 0 to BPF-1 do
    begin
      SG.Cells[i+1,0]:= IntToHex(i,2);
    end;

    // Cargar en StringGrid

    Seek(0, soBeginning);
    c:= 0;
    r:= 1;
    b := 0;

    while c < Size do
    begin

      Application.ProcessMessages;

      if CancelProcess then
      begin
         CancelProcess := False;
         Break;
      end;

      SG.Cells[0, r]:= Format('%s',[IntToHex(c, 8)]);
      Ascii:= EmptyStr;
      i:= 0;

      while (i < BPF) and (b < Size) do
      begin
        Read(Aux, SizeOf(Byte));
        SG.Cells[i+1,r]:= IntToHex(Aux,2);
        if Aux = 0 then Aux := 46;
        Ascii:= Ascii + Chr(Aux);
        Inc(i);
        if (b < Size) then Inc(b);
      end;

      SG.Cells[SG.ColumnCount-1,r]:= Format('%s',[Ascii]);
      Inc(c, BPF);
      Inc(r);
      Label1.Text := Format('Procesado Byte %d de %d',[b, Size]);

    end;

  finally

    Free;

  end;

end;
El código anterior en Delphi XE4 bajo Windows 7 Professional x32, corrige el código del Msg #15 en los casos en que los archivos a visualizar no sean múltiplos del factor de visualización (BPF), como se muestra en la siguiente imagen:



El código esta disponible en : Visualizador de Archivos en Hexadecimal v2 en FireMonkey

Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 07-05-2014 a las 21:32:39.
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
ayuda con este codigo kurono Varios 5 02-04-2014 00:25:11
Se estrena este foro sobre FireMonkey Neftali [Germán.Estévez] FireMonkey 9 09-11-2012 13:05:30
ayuda con este codigo kurono Varios 4 13-06-2008 01:03:29
necesito ayuda con este codigo kurono Varios 4 06-05-2008 07:02:07
procedimiento almacenado ayuda con este codigo pipecato Varios 5 16-12-2005 12:24:34


La franja horaria es GMT +2. Ahora son las 04:59:31.


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