42 lines
1.4 KiB
PowerShell
42 lines
1.4 KiB
PowerShell
$file = "UIrrigation_Impl.inc"
|
|
$content = Get-Content $file -Encoding UTF8 -Raw
|
|
|
|
$oldEval = @"
|
|
function EvalIrriConditions(const AConds: array of TAutoCondItem): Boolean;
|
|
var i: Integer;
|
|
begin
|
|
if Length(AConds) = 0 then Exit(True);
|
|
for i := 0 to High(AConds) do
|
|
if not frmMain.EvalOneCondition(AConds[i]) then
|
|
Exit(False);
|
|
Result := True;
|
|
end;
|
|
"@
|
|
|
|
$newEval = @"
|
|
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;
|
|
"@
|
|
|
|
$content = $content.Replace($oldEval, $newEval)
|
|
$content = $content.Replace("EvalIrriConditions(CurAct.EndConds)", "EvalIrriConditions(CurAct.EndConds, CurAct.EndCondMode)")
|
|
$content = $content.Replace("EvalIrriConditions(CurAct.StartConds)", "EvalIrriConditions(CurAct.StartConds, CurAct.StartCondMode)")
|
|
$content = $content.Replace("EvalIrriConditions(CurAct.StopConds)", "EvalIrriConditions(CurAct.StopConds, CurAct.StopCondMode)")
|
|
|
|
Set-Content -Path $file -Value $content -Encoding UTF8
|