procedure SaveTheSettings(Sender:TObject);
var path:string;
i:integer;
begin
Path := AppPath+'WidgetSettings.ini';
WriteINI('Settings','StatsID',OtherEdits[1].Text,Path);
WriteINI('Settings','StatsPass',Encrypt(OtherEdits[2].Text),Path);
WriteINI('Settings','MouseSpeed',OtherEdits[3].Text,Path);
WriteINI('Settings','Loads',OtherEdits[4].Text,Path);
WriteINI('Settings','UsePouches',BoolToStr(Checks[1].Checked),Path);
WriteINI('Settings','AutoRespond',BoolToStr(Checks[2].Checked),Path);
WriteINI('Settings','Players',IntToStr(GetArrayLength(PlayerFormEdits[1])),Path);
for i := 0 to (GetArrayLength(PlayerFormEdits[1])-1) do
begin
WriteINI('Player'+inttostr(i),'User',PlayerFormEdits[1][i].Text,Path);
WriteINI('Player'+inttostr(i),'Pass',Encrypt(PlayerFormEdits[2][i].Text),Path);
WriteINI('Player'+inttostr(i),'Nick',PlayerFormEdits[3][i].Text,Path);
WriteINI('Player'+inttostr(i),'PIN',PlayerFormEdits[4][i].Text,Path);
end;
end;
procedure LoadTheSettings(Sender:TObject);
var path:string;
i:integer;
begin
Path := AppPath+'WidgetSettings.ini';
if not FileExists(path) then Exit;
OtherEdits[1].Text := ReadINI('Settings','StatsID',path);
OtherEdits[2].Text := Decrypt(ReadINI('Settings','StatsPass',path));
OtherEdits[3].Text := ReadINI('Settings','MouseSpeed',path);
OtherEdits[4].Text := ReadINI('Settings','Loads',path);
for i := 2 to GetArrayLength(PlayerFormEdits[1]) do
SafeDeletePlayer(Form);
for i := 0 to (StrToIntDef(ReadINI('Settings','Players',path),0)-1) do
begin
if (i>0) then
SafeAddPlayer(Form);
PlayerFormEdits[1][i].Text := ReadINI('Player'+inttostr(i),'User',path);
PlayerFormEdits[2][i].Text := Decrypt(ReadINI('Player'+inttostr(i),'Pass',path));
PlayerFormEdits[3][i].Text := ReadINI('Player'+inttostr(i),'Nick',path);
PlayerFormEdits[4][i].Text := ReadINI('Player'+inttostr(i),'PIN',path);
end;
Checks[1].Checked := StrToBoolDef(ReadINI('Settings','UsePouches',path),False);
Checks[2].Checked := StrToBoolDef(ReadINI('Settings','AutoRespond',path),False);
end;
That's what I do :)