1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
TepcConfigControllerReportItem = record
IsError: Boolean;
NumLine: Integer;
CheckType: string;
SKV: string; // Ini [Section]Key=Value
Msg: string;
end;
...
class function TepcConfigController.ReadReport(const ReportFileName: string): Boolean;
function StringRead(var F: File; out S: string): Integer;
begin
BlockRead(F, Result, SizeOf(Result));
SetLength(S, Result);
if Result > 0 then
BlockRead(F, S[1], Result, Result);
end;
var
ReportFile: file;
Item: TepcConfigControllerReportItem;
begin
_CCReport.Clear();
if FileExists(ReportFileName) then
begin
AssignFile(ReportFile, ReportFileName);
Reset(ReportFile, 1);
try
while not Eof(ReportFile) do
begin
BlockRead(ReportFile, Item.IsError, SizeOf(Item.IsError));
StringRead(ReportFile, Item.CheckType);
StringRead(ReportFile, Item.SKV);
StringRead(ReportFile, Item.Msg);
_CCReport.Add(Item);
end;
finally
CloseFile(ReportFile);
end;
end;
Result := _CCReport.Count > 0;
end; |
Partager