28 lines
997 B
PowerShell
28 lines
997 B
PowerShell
$file = "UIrrigation_Impl.inc"
|
|
$text = Get-Content $file -Encoding UTF8 -Raw
|
|
|
|
$pattern = "(?s)function EvalIrriConditions\(const AConds: array of TAutoCondItem\): Boolean;\s+var i: Integer;\s+begin\s+if Length\(AConds\) = 0 then Exit\(True\); \s+for i := 0 to High\(AConds\) do\s+if not frmMain.EvalOneCondition\(AConds\[i\]\) then\s+Exit\(False\);\s+Result := True; \s+end;"
|
|
|
|
$replacement = @"
|
|
function EvalIrriConditions(const AConds: array of TAutoCondItem; AMode: TAutoCondMode): Boolean;
|
|
var i: Integer;
|
|
begin
|
|
if Length(AConds) = 0 then Exit(True);
|
|
if AMode = acmOR then
|
|
begin
|
|
for i := 0 to High(AConds) do
|
|
if frmMain.EvalOneCondition(AConds[i]) then Exit(True);
|
|
Result := False;
|
|
end
|
|
else
|
|
begin
|
|
for i := 0 to High(AConds) do
|
|
if not frmMain.EvalOneCondition(AConds[i]) then Exit(False);
|
|
Result := True;
|
|
end;
|
|
end;
|
|
"@
|
|
|
|
$text = [regex]::Replace($text, $pattern, $replacement)
|
|
Set-Content $file -Value $text -Encoding UTF8
|