AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte Klasse: HTTPDownloader...
Thema durchsuchen
Ansicht
Themen-Optionen

Klasse: HTTPDownloader...

Ein Thema von Real-TTX · begonnen am 29. Apr 2009 · letzter Beitrag vom 1. Mai 2009
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.316 Beiträge
 
Delphi 12 Athens
 
#4

Re: Klasse: HTTPDownloader...

  Alt 29. Apr 2009, 22:19
Delphi-Quellcode:
if @DownloadBegin <> nil then
  DownloadBegin(CurrentDownload);

if @DownloadEnd <> nil then
  DownloadEnd(CurrentDownload);

if @DownloadWork <> nil then
  begin
dieses ist immer <> nil, denn die Variablen sind immer vorhanden
Delphi-Quellcode:
if Assigned(DownloadBegin) then
  DownloadBegin(CurrentDownload);

if Assigned(DownloadEnd) then
  DownloadEnd(CurrentDownload);

if Assigned(DownloadWork) then
  begin

// und wenn schon NIL, dann eher so
if Pointer(DownloadBegin) <> nil then
  DownloadBegin(CurrentDownload);


Delphi-Quellcode:
// Standartwer falls Property nicht gesetzt = 2, urNormal
intRate := 2;
// urUpdateRate auswählen
case urUpdateRate of
  urFast : begin intRate := 1; end;
  urNormal : begin intRate := 2; end;
  urSlow : begin intRate := 3; end;
end;
schonmal etwas vom ELSE gehört und wozu die Begin-End?
Delphi-Quellcode:
// urUpdateRate auswählen
case urUpdateRate of
  urFast : intRate := 1;
  urSlow : intRate := 3;
  else intRate := 2;
end;

mit ein paar ELSE könne man einige Vergleiche eh weglassen, samt der "unnötigen" Exit.
ja meinst du, daß über 1 Terrabyte wirklich nötig sind?
PS: laut berechnung ist dein GB ein TB und GBhast du ganz vergessen
(1.099.511.627.776 = 1 TB)
Delphi-Quellcode:
function THTTPDownloader.GetSizeName(const Size : int64): String;
begin
  if Size > 1073741824 then
    Result := floattostr(trunc(Size/1073741824*100)/100)+' GB'
  else if Size > 1048576 then
    Result := floattostr(trunc(Size/1048576*100)/100)+' MB'
  else if Size > 1024 then
    Result := floattostr(trunc(Size/1024*100)/100)+' KB'
  else if Size >= 0 then
    Result := inttostr(Size)+' Byte'
  else
    Result := 'Error';
end;
.......




PS: von da drüben läßt sich dein Code nicht nutzen ... beim Rauskopieren wird da je Zeile eine Zeile mit 'nem # eingefügt ... voll unpraktisch
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:46 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz