Autor Beitrag
.#R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mo 26.11.07 20:40 
Hallo!

Ich suche eine möglichkeit, den Section Name von z.B. "[Item92]" in "[Item91]" um zu schreiben also immer den Item Index um eins runterschrauben.

Möglich?

Gruß
R4id
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Mo 26.11.07 20:49 
Mit IniFiles Mitteln wird das nicht gehen. Umbenennen ist da nicht vorgesehen.

Was du machen könntest ist die Zeile zu suchen und zu ersetzten oder alle Werte der Sektion zwischenspeichern, Sektion löschen und unter neuen Sektion wieder speichern.

_________________
Popov
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Mo 26.11.07 21:07 
So könnte es gehen. Du brauchst allerdings die EasyIniAppExe von hier. Du kannst es aber auch umschreiben und es mit normaler IniFiles Unit machen.

Funktionieren tut das Beispie, hab es gerade getestet. Es wird eine neue Sektion erstellt und mit den Daten der alten Sektion gefüllt und dann wird die alte Sektion gelöscht.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure TForm1.Button1Click(Sender: TObject);
var
  sl: TStringList;
  SectionAlt, SectionNeu: String;
  i: Integer;
begin
  sl := TStringList.Create;
  try
    SectionAlt := 'Item92';
    SectionNeu := 'Item91';

    ReadIniSection(SectionAlt, sl);

    for i := 0 to sl.Count - 1 do
      WriteIniString(SectionNeu, sl[i], ReadIniString(SectionAlt, sl[i], ''));

    EraseIniSection(SectionAlt);
  finally
    sl.Free;
  end;
end;

_________________
Popov
.#R4id Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mo 26.11.07 21:24 
Also bei mir kommt der fehler
ausblenden Quelltext
1:
Invalid class typecast					


... :-(
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Mo 26.11.07 21:35 
Kann ich mir nicht vorstellen.

_________________
Popov