Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

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

Re: filesize summieren und von byte nach Mb rechnen

  Alt 21. Nov 2003, 23:32
hab noch was anderes für dich:

Freigabe von SearchRec berichtigt (siehe Beispiel in der OH):
Delphi-Quellcode:
  Function GetFileSize(FileName: String): Integer;
    Var SR: TSearchRec;

    Begin
      If FindFirst(Filename, faAnyFile, SR) = 0 Then Begin
        Result := SR.Size;
{}      FindClose(SR);
      End Else Result := -1;
    End;
Ein bissl Codeoptinierung:
Delphi-Quellcode:
  Function Status(Wert: Integer; FileSize: Int64): String;
    Var I: Integer;

    Begin
      If Wert = sfvfile.count Then
{}      Result := '[AA] - ( ' + IntToStr(sfvfile.count) + 'F ' + IntToStr(FileSize shr 20) + 'M - COMPLETE ) - [AA]'
      Else Begin
        Result := '[';
{}      For I := 1 to ((Wert * sfvfile.count) div 1000) do
          Result := Result + '#';
{}      For I := ((Wert * sfvfile.count) div 1000) + 1 to 10 do
          Result := Result + '-';
{}      Result := Result + '] - ' + IntToStr((Wert * sfvfile.count) div 100) + '% Complete - [AA]';
      End;
      OldStatus := Result;
    End;
Delphi-Quellcode:
{10 Bit = 1024}
X div 1024 div 1024 = X shr 20 {arbeitet schneller}
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat