unit settingsset; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Registry; type TSetSet = class(TObject) private const RegLoc = '\Software\SDC\Play'; lGen = '\general'; lPlay = '\playlist'; public BoolChrs : string; // YN eller * eller hvad der nu er valgt StoreTiming : boolean; PlayTimerInterval : integer; PlayAuto : boolean; PlayAutoInterval : integer; HistoryRec : boolean; HistoryAnt : integer; ToMetric : boolean; IgnoreCards, IgnoreModels : string; procedure ReadSet; procedure WriteSet; end; implementation uses MyStringFunc; procedure TSetSet.ReadSet; var reg : TRegistry; begin reg := TRegistry.Create; reg.RootKey := HKEY_CURRENT_USER; if reg.OpenKey(RegLoc+lGen, true) then begin // General settings BoolChrs := IsEmpty(reg.ReadString('BoolChrs'), 'YN'); ToMetric := CharToBool(IsEmpty(reg.ReadString('ToMetric'), 'Y')[1]); IgnoreCards := reg.ReadString('IgnoreCards'); IgnoreModels := reg.ReadString('IgnoreModels'); reg.CloseKey; end; if reg.OpenKey(RegLoc+lPlay, true) then begin // Autoplay settings StoreTiming := CharToBool(IsEmpty(reg.ReadString('StoreTiming'), 'N')[1]); PlayTimerInterval := StrToInt(IsEmpty(reg.ReadString('PlayTimerInterval'), '500')); PlayAuto := CharToBool(IsEmpty(reg.ReadString('PlayAuto'), 'N')[1]); PlayAutoInterval := StrToInt(IsEmpty(reg.ReadString('PlayAutoInterval'), '200')); HistoryRec := CharToBool(IsEmpty(reg.ReadString('HistoryRec'), 'Y')[1]); HistoryAnt := StrToInt(IsEmpty(reg.ReadString('HistoryAnt'), '20')); reg.CloseKey; end; reg.Free; end; procedure TSetSet.Writeset; var reg : TRegistry; begin reg := TRegistry.Create; reg.RootKey := HKEY_CURRENT_USER; if reg.OpenKey(RegLoc+lGen, true) then begin // General settings reg.WriteString('BoolChrs', BoolChrs); reg.WriteString('ToMetric', BoolToChar(ToMetric)); reg.WriteString('IgnoreCards', IgnoreCards); reg.WriteString('IgnoreModels', IgnoreModels); reg.CloseKey; end; if reg.OpenKey(RegLoc+lPlay, true) then begin // Autoplay settings reg.WriteString('StoreTiming', BoolToChar(StoreTiming)); reg.WriteString('PlayTimerInterval', IntToStr(PlayTimerInterval)); reg.WriteString('PlayAuto', BoolToChar(PlayAuto)); reg.WriteString('PlayAutoInterval', IntToStr(PlayAutoInterval)); reg.WriteString('HistoryRec', BoolToChar(HistoryRec)); reg.WriteString('HistoryAnt', IntToStr(HistoryAnt)); reg.CloseKey; end; reg.Free; end; end.