Einzelnen Beitrag anzeigen

Real-TTX

Registriert seit: 7. Mai 2008
Ort: Stuttgart / Wertheim
136 Beiträge
 
Delphi 2007 Enterprise
 
#1

Application.Terminate bei geöffneter Datei - Fehler?

  Alt 16. Apr 2009, 19:25
Wie im Thread-Titel schon geschrieben verursacht Application.Terminate ein Fehler in meiner EOF Schleife....

Hier der Code :
Delphi-Quellcode:
procedure TFrmMain.FileParse(strFile : string);
var
  Datei: TextFile;
  strZeile, strCommand, strParam : string;
  RegEx, RegExLine : TRegExpr;
  intCountDownloads, intMaxDownloads : integer;
begin

  intCountDownloads := 0;
  intMaxDownloads := 0;
  RegEx := TRegExpr.Create;
  RegExLine := TRegExpr.Create;

  RegEx.Expression := '^\s*(\w+)\s*\=(.+)\s*\;$';
  AssignFile(Datei, strFile);
  Reset(Datei);

  while not eof(Datei) do
  begin
    ReadLn(Datei, strZeile);
    if RegEx.Exec(strZeile) then
    begin
      strCommand := RegEx.Match[1];
      strParam := RegEx.Match[2];

      if strCommand = 'create_directorythen
      begin
        if not DirectoryExists(strParam) then
        CreateDir(strParam);
      end else if strCommand = 'downloadthen
      begin
        RegExLine.Expression := '^\s*(.+)\s*\;(.+)\s*';
        if RegExLine.Exec(strParam) then
        begin
          inc(intCountDownloads);

          if intMaxDownloads > 0 then
          begin
            LabelFileNummer.Caption := IntToStr(intCountDownloads) + ' / ' + IntToStr(intMaxDownloads);
          end else begin
            LabelFileNummer.Caption := IntToStr(intCountDownloads);
          end;

          HTTPDownloadFile(RegExLine.Match[1],RegExLine.Match[2]);
          ProgressBarAll.StepIt;
        end;
      end else if strCommand = 'downloadsthen
      begin
        intMaxDownloads := strtoint(strParam);
        ProgressBarAll.Max := intMaxDownloads;
      end else if strCommand = 'exitthen
      begin
        CloseFile(Datei);
        Application.Terminate;
      end;
    end;
  end;
  CloseFile(Datei);
end;
Danke für jede Anmerkung und Idee

Gruß, Real-TTX
  Mit Zitat antworten Zitat