procedure DeleteIfTooLarge(AFileName: TFileName);
Var
FileStream : TFileStream;
IsTooLarge : Boolean;
begin
if Not FileExists(AFileName) then exit;
FileStream := TFileStream.Create(AFileName,fmOpenRead);
try
IsTooLarge := FileStream.Size > MaxSize;
finally
FileStream.Free;
end;
if IsTooLarge then
DeleteFile(AFileName);
end;
RZFileName := ExtractFilePath(Application.ExeName)+'下发日志.log';
DeleteIfTooLarge(RZFileName);
AssignFile(FLog,RZFileName);
if FileExists(RZFileName) then
Append(FLog)
else
Rewrite(FLog);