procedure TSDIAppForm.UpdateList;
var
regexpr : TRegExpr;
i, j : Integer;
begin
regexpr := TRegExpr.Create;
List.Items.BeginUpdate;
try
i := 0;
j := ini.ReadInteger('Number','Start',0);
while (i <= List.Count-1) do
begin
if stx.ReadBool('Replace','Number',ini.ReadBool('System','Number',true)) then
begin
regexpr.Expression := stx.ReadString('Replace','NumSignRegExp',
ini.ReadString('Number','SignRegExp','(?i)^N(\d+)\s*(.*)'));
if (i = 0) and (stx.ReadBool('Replace','ID',ini.ReadBool('System','ID',true))) then
begin
regexpr.Exec(List.Items[i]);
if OpenFileID = 0 then
List.Items[i] := SysFuncs.SearchAndReplace(
SysFuncs.SearchAndReplace(
regexpr.Replace(
List.Items[i],
stx.ReadString('Replace','IDSign',
ini.ReadString('ID','Sign','N$#')),
true
),
'$s',
' '
),
'$#',
IntToStr(List.Count-1)
)
else
List.Items[i] := SysFuncs.SearchAndReplace(
SysFuncs.SearchAndReplace(
regexpr.Replace(
List.Items[i],
stx.ReadString('Replace','IDSign',
ini.ReadString('ID','Sign','N$#')),
true
),
'$s',
' '
),
'$#',
IntToStr(OpenFileID)
);
end
else if not (List.Items[i] = '') then
begin
if regexpr.Exec(List.Items[i]) then
List.Items[i] := SysFuncs.SearchAndReplace(
SysFuncs.SearchAndReplace(
regexpr.Replace(
List.Items[i],
stx.ReadString('Replace','NumSign',
ini.ReadString('Number','Sign','N$#$s$2')),
true
),
'$s',
' '
),
'$#',
IntToStr(j)
)
else
List.Items[i] := SysFuncs.SearchAndReplace(
SysFuncs.SearchAndReplace(
SysFuncs.SearchAndReplace(
stx.ReadString('Replace','NumSignIns',
ini.ReadString('Number','SignIns','N$#$s$a')),
'$a',
List.Items[i]
),
'$s',
' '
),
'$#',
IntToStr(j)
);
//showmessage (List.Items[i]);
end;
end;
List.Items[i] := CorrectLine(List.Items[i]);
i := i + 1;
j := j + ini.ReadInteger('Number','Width',1);
end;
finally
regexpr.Free;
end;
if not (List.Items[List.Count-1] = '') then
List.Items.Add('');
List.Items.EndUpdate;
end;