All pastes #91785 Raw Edit

Untitled

public text v1 · immutable
#91785 ·published 2006-07-18 22:35 UTC
rendered paste body
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  f:TStringStream;
  fl:TFileStream;
  s:string;
  i:integer;
begin
  statusLbl.caption := 'Downloading file list...';
  try
    //step 1
    //getting filelist
    f := TStringStream.Create(s);
    idHTTP1.Get('http://caggelop.phpnet.us/upd/filelist.dat',f);
    FormatFilelist(f.DataString);
    IdHTTP1.Disconnect;
    //step 2
    //download needed files
    if not MustProccedToDownload then WeAreReady
    else begin
      for i := 0 to ToBeDL.Count - 1 do begin
        try

          statusLbl.Caption := 'Downloading File ' + ToBeDl.Strings[i] + '...';
          fl := TFileStream.Create(ToBeDl.Strings[i],fmCreate);
          idHTTP1.Get('http://caggelop.phpnet.us/upd/files/' + ToBeDl.Strings[i],fl);
          //Application.ProcessMessages;
          IdHTTP1.Disconnect;
        finally
          fl.Free;
        end;
      end;
      WeAreReady;
    end;
  finally
    f.Free;
  end;
end;


procedure TForm1.IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
begin
  pb.Position := AWorkCount;
  Application.ProcessMessages;
end;