Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 18-02-2011
jathinson jathinson is offline
Registrado
 
Registrado: jul 2007
Posts: 2
Poder: 0
jathinson Va por buen camino
read en 2010

bueno nesecito una ayuda con algo que me pasa en delphi 2010
tengo un archivo lo cargo en un TFileStream;

asi
Código Delphi [-]
  path:=getpath (Edit2.Text);//saca el path del archivo
   if FileExists(path) then
  begin
     f := TFileStream.Create(path, fmOpenRead);
      if(Load(f)) then begin
       showmessage('1');
  end;
 
function TForm1.Load(Stream: TStream): Boolean;
var
  o: TObject;
begin
 o := bdecodeStream(Stream);
end;
 
function TForm1.bdecodeStream(s: TStream): TObject;
var
  r: TObject;
  c: char;
  n: Integer;
begin
  n := s.Read(c, 1);
  if(n > 0) then begin
    begin
     Edit1.Text := c;
      r := nil;
    end;
  end else begin
    r := nil;
  end;
  bdecodeStream := r;
end;
el resultado en Edit1.Text es 'd'

pero al hacer lo el cliente de torrent no da un char 'ɤ' extraño como un cuadro

lo unioco raro es que lo hago desde un solo for y ello desde varia unidades

asi
Código Delphi [-]
 
procedure TfrmSeeder.txtTorrentFileChange(Sender: TObject);
var f:TFileStream;
    i:integer;
    path:string;
    thisfile:TTorrentSubFile;
begin
  path:=StripQuotes(txtTorrentFile.Text);
  if FileExists(path) then
  begin
    try
      f := TFileStream.Create(path, fmOpenRead);
      if(TorrentFile.Load(f)) then begin
...
...
end;
 
unit TorrentFile;
..
..
function TTorrentFile.Load(Stream: TStream): Boolean;
var
  info, thisfile: TObjectHash;
  files, path, backup, backup2: TObjectList;
  fp, fn: String;
  i, j, pcount: Integer;
  sz, fs, fo: Int64;
  sha: TSHA1;
  r: Boolean;
  o: TObject;
  p: pointer;
  s:string;
begin
  Clear();
  r := False;
  sz := 0;
  try
    try
      sha := TSHA1.Create();
o := bdecodeStream(Stream);
 
...
...
end;
 
 
unit BDecode;
...
..
..
function bdecodeStream(s: TStream): TObject;
var
  r: TObject;
  c: char;
  n: Integer;
begin
  n := s.Read(c, 1);
  if(n > 0) then begin
    case c of
    'd' : r:= bdecodeHash(s);
    'l' : r:= bdecodeList(s);
    'i' : r:= bdecodeInt64(s);
    '0'..'9' : r:= bdecodeString(s,StrToInt(c));
    else r := nil;
    end;
  end else begin
    r := nil;
  end;
  bdecodeStream := r;
end;
aqui el resul nunca es 'd' si alguien sabe se lo agradesco de antemano
end;

Última edición por ecfisa fecha: 18-02-2011 a las 22:51:21. Razón: ETIQUETAS DELPHI
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
Index is Read Only KAYO Conexión con bases de datos 1 13-07-2006 17:04:19
Procedimiento read ber Varios 3 24-11-2005 00:44:59
Sintaxis Read ber Varios 2 21-11-2005 19:13:11
index is read only aurbano Tablas planas 3 04-11-2005 21:55:39
Cannot a Read only a DataSet JorgeBec Conexión con bases de datos 1 11-08-2004 23:08:26


La franja horaria es GMT +2. Ahora son las 17:48:04.


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