33 lines
2.1 KiB
PowerShell
33 lines
2.1 KiB
PowerShell
$file = "UIrrigation_Impl.inc"
|
|
$text = Get-Content $file -Encoding UTF8 -Raw
|
|
|
|
$text = $text.Replace(
|
|
"JSched.TryGetValue<Integer>('RepeatDays', FIrriSchedules[i].RepeatDays);",
|
|
"JSched.TryGetValue<Integer>('RepeatDays', FIrriSchedules[i].RepeatDays);`r`n JSched.TryGetValue<Integer>('LimitOnesTimeMin', FIrriSchedules[i].LimitOnesTimeMin);"
|
|
)
|
|
|
|
$text = $text.Replace(
|
|
"JSched.AddPair('RepeatDays', TJSONNumber.Create(FIrriSchedules[i].RepeatDays));",
|
|
"JSched.AddPair('RepeatDays', TJSONNumber.Create(FIrriSchedules[i].RepeatDays));`r`n JSched.AddPair('LimitOnesTimeMin', TJSONNumber.Create(FIrriSchedules[i].LimitOnesTimeMin));"
|
|
)
|
|
|
|
$replaceLoadAct = @"
|
|
JAct.TryGetValue<Integer>('TimeoutMin', FIrriSchedules[i].Actions[j].TimeoutMin);
|
|
|
|
var ModeInt: Integer;
|
|
if JAct.TryGetValue<Integer>('StartCondMode', ModeInt) then FIrriSchedules[i].Actions[j].StartCondMode := TAutoCondMode(ModeInt) else FIrriSchedules[i].Actions[j].StartCondMode := acmAND;
|
|
if JAct.TryGetValue<Integer>('StopCondMode', ModeInt) then FIrriSchedules[i].Actions[j].StopCondMode := TAutoCondMode(ModeInt) else FIrriSchedules[i].Actions[j].StopCondMode := acmAND;
|
|
if JAct.TryGetValue<Integer>('EndCondMode', ModeInt) then FIrriSchedules[i].Actions[j].EndCondMode := TAutoCondMode(ModeInt) else FIrriSchedules[i].Actions[j].EndCondMode := acmAND;
|
|
"@
|
|
$text = $text.Replace("JAct.TryGetValue<Integer>('TimeoutMin', FIrriSchedules[i].Actions[j].TimeoutMin);", $replaceLoadAct)
|
|
|
|
$replaceSaveAct = @"
|
|
JAct.AddPair('TimeoutMin', TJSONNumber.Create(FIrriSchedules[i].Actions[j].TimeoutMin));
|
|
JAct.AddPair('StartCondMode', TJSONNumber.Create(Integer(FIrriSchedules[i].Actions[j].StartCondMode)));
|
|
JAct.AddPair('StopCondMode', TJSONNumber.Create(Integer(FIrriSchedules[i].Actions[j].StopCondMode)));
|
|
JAct.AddPair('EndCondMode', TJSONNumber.Create(Integer(FIrriSchedules[i].Actions[j].EndCondMode)));
|
|
"@
|
|
$text = $text.Replace("JAct.AddPair('TimeoutMin', TJSONNumber.Create(FIrriSchedules[i].Actions[j].TimeoutMin));", $replaceSaveAct)
|
|
|
|
Set-Content $file -Value $text -Encoding UTF8
|