-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This is a simple script that works around a defined "protocol" of commands. Adding/Removing logic is usually just a matter of editing this protocol.
$BrewTrollerBackupProtocol = @"
Name,ScopeList,BackupCommand,RestoreCommand,MaximumIndex
Volume Calibration,Volume;VolumeCalibration,B,L,29
Output Profiles,OutputProfiles,d,Q,23
Recipes,Recipes,@,?,19
Boil Temperature,SystemSettings;BoilTemp,A,K,-1
Boil Power,SystemSettings;BoilPower,f,i,-1
Evaporation Rate,SystemSettings;EvapRate,C,M,-1
Outputs,Outputs,D,N,2
Temperature Sensors,TemperatureSensors,F,P,8
Volume Capacity,Volume;VolumeCapacity,H,R,2
"@ | ConvertFrom-CSV
The above creates an array of 9 objects that represent available backup/restore command pairs.
The Scope property allows simple filtering during backup and/or restore using a scope keyword.
The MaximumIndex is used for commands that have an index. A MaximumIndex of -1 indicates there is no index used in the command.
The Recipes restore command requires a hack as the GET command returns a few calculated fields that cannot be sent back in the SET command. The below line splits and joins a subset of fields (0-22) on Recipe restores:
if ($restoreCommand.Name -eq "Recipes") { $line = (($line -split"t")[0..22]) -join "t" }
Data is saved/loaded from standard text files making it easy for someone to edit values or trim down a restore to certain indexes of a command (ie Recipes, etc.).