1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
FileIni:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'/test_clubs.ini'); // Ouvre ou crée le fichier
clubs := TStringList.Create;
VAL := TStringList.Create;
VAL_teams := TStringList.Create;
VAL_athletes := TStringList.Create;
FileIni.readsections('CLUBS',clubs);
for i := 0 to clubs.Count-1 do
begin
nod := nil;
FileIni.ReadSectionValues(clubs[i], VAL);
for j := 0 to VAL.Count-1 do
begin
s:=Pos('=',VAL[j]);
TreeView1.Items.AddChild(nod,(copy(VAL[j],s+1,Length(VAL[j])-1)));
FileIni.ReadSectionValues(copy(VAL[j],s+1,Length(VAL[j])-1)+'.teams', VAL_teams);
Node := TreeView1.Items[j];
for z := 0 to VAL_teams.Count-1 do
begin
TreeView1.Items.AddChild(Node, VAL_teams[z]);
Node := TreeView1.Items[j];
for y := 0 to Node.Count-1 do
begin
Node1 := Node.Item[j];
FileIni.ReadSectionValues(copy(VAL[j],s+1,Length(VAL[j])-1)+'.athletes', VAL_athletes);
for x := 0 to VAL_athletes.Count-1 do
begin
s:=Pos('=',VAL_athletes[x]);
name := copy(VAL_athletes[x],1,s-1);
test := copy(VAL_athletes[x],s+1,Length(VAL_athletes[x])-1);
for w := 0 to length(test)-1 do
begin
if copy(Node.Item[y].Text,1,1) = copy(test,1,1) then
begin
TreeView1.Items.AddChild(Node.Item[y], name);
if Length(test) > 1 then
Delete(test,1,2);
end;
end;
end;
end;
end;
end;
end;
Clubs.Free;
VAL.Free;
VAL_teams.Free;
VAL_athletes.Free;
FileIni.Free;
TreeView1.FullExpand; |
Partager