home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sibdemo3.zip / SOURCE.DAT / SOURCE / SPCC / INIFILES.PAS < prev    next >
Pascal/Delphi Source File  |  1998-01-24  |  18KB  |  704 lines

  1.  
  2. {╔══════════════════════════════════════════════════════════════════════════╗
  3.  ║                                                                          ║
  4.  ║     Sibyl Portable Component Classes                                     ║
  5.  ║                                                                          ║
  6.  ║     Copyright (C) 1995,97 SpeedSoft Germany,   All rights reserved.      ║
  7.  ║                                                                          ║
  8.  ╚══════════════════════════════════════════════════════════════════════════╝}
  9.  
  10. Unit IniFiles;
  11.  
  12. { TIniFile: Standard (binäres) OS/2 Inifile
  13.   TAsciiIniFile: Text-Inifile, lesbar, mit Editor zu bearbeiten.
  14.  
  15.   Beide benutzen exakt das gleiche Interface und sind bis
  16.   auf Die neue Methode 'Erase' kompatibel zu den normalen
  17.   Delphi-IniFiles. }
  18.  
  19. Interface
  20.  
  21. Uses Classes,SysUtils;
  22.  
  23. {$IFDEF OS2}
  24. Uses PMSHL; { OS/2 profile FUNCTIONs }
  25. {$ENDIF}
  26. {$IFDEF Win95}
  27. Uses WinBase;
  28. {$ENDIF}
  29.  
  30. Type
  31.   EIniFileError = Class(Exception);
  32.  
  33. Type
  34.   TIniFile = Class(TObject)
  35.   Private
  36.     FFileName: PString;         // Physical Name Of File
  37.     {$IFDEF OS2}
  38.     FHandle: HINI;              // profile Handle
  39.     {$ENDIF}
  40.     Function GetFileName: String;
  41.  
  42.   Protected
  43.     Procedure Error(Const Msg: String); Virtual;
  44.  
  45.   Public
  46.     Constructor Create(Const FileName: String);Virtual;
  47.     Destructor Destroy; Override;
  48.     Procedure Erase(Const section, Ident: String); Virtual;
  49.     Procedure EraseSection(Const section: String); Virtual;
  50.     Function ReadString(Const section, Ident, Default: String): String; Virtual;
  51.     Function ReadInteger(Const section, Ident: String; Default: LongInt): LongInt; Virtual;
  52.     Function ReadBool(Const section, Ident: String; Default: Boolean): Boolean; Virtual;
  53.     Procedure ReadSection(Const section: String; AStrings: TStrings); Virtual;
  54.     {Procedure ReadSections(AStrings: TStrings); fehlt noch}
  55.     Procedure ReadSectionValues(Const section: String; AStrings: TStrings); Virtual;
  56.     Procedure WriteString(Const section, Ident, Value: String); Virtual;
  57.     Procedure WriteInteger(Const section, Ident: String; Value: LongInt); Virtual;
  58.     Procedure WriteBool(Const section, Ident: String; Value: Boolean); Virtual;
  59.  
  60.     Property FileName: String
  61.       Read GetFileName;
  62.   End;
  63.  
  64. Type
  65.   {$HINTS OFF}
  66.   TAsciiIniFile = Class(TIniFile)
  67.   Private
  68.     //FFileName: PString;         // Physical Name Of File
  69.     FSections: TStringList;     // List Of Sections And their Names
  70.     FName: PString;             // Name Of Last used section
  71.     FList: TStringList;         // List Of Last used section
  72.     FChanged: Boolean;          // has the Data been changed?
  73.     Procedure WriteToSection(Const section: String);
  74.     Function ReadFromSection(Const section: String): Boolean;
  75.     //Function GetFileName: String;
  76.  
  77.   Protected
  78.     TrueString: String[7];
  79.     FalseString: String[7];
  80.     SectionSort: Boolean;
  81.     IdentSort: Boolean;
  82.   Protected
  83.     Procedure InitIniFile;Virtual;
  84.  
  85.   Public
  86.     Constructor Create(Const FileName: String);Virtual;
  87.     Destructor Destroy; Override;
  88.     Procedure Erase(Const section, Ident: String); Override;
  89.     Procedure EraseSection(Const section: String); Override;
  90.     Function ReadString(Const section, Ident, Default: String): String; Override;
  91.     Function ReadInteger(Const section, Ident: String; Default: LongInt): LongInt; Override;
  92.     Function ReadBool(Const section, Ident: String; Default: Boolean): Boolean; Override;
  93.     Procedure ReadSection(Const section: String; AStrings: TStrings); Override;
  94.     Procedure ReadSections(AStrings: TStrings);
  95.     Procedure ReadSectionValues(Const section: String; AStrings: TStrings); Override;
  96.     Procedure Refresh;
  97.     Procedure WriteString(Const section, Ident, Value: String); Override;
  98.     Procedure WriteInteger(Const section, Ident: String; Value: LongInt); Override;
  99.     Procedure WriteBool(Const section, Ident: String; Value: Boolean); Override;
  100.  
  101.     Property FileName: String
  102.       Read GetFileName;
  103.     Property changed: Boolean
  104.       Read FChanged Write FChanged;
  105.   End;
  106.   {$HINTS ON}
  107.  
  108. Function GetDefaultINI: String;
  109.   { Get Name Of INI-File that matches Program Path & Name With
  110.     extension .INI instead Of .EXE }
  111.  
  112. Implementation
  113.  
  114. Uses
  115.   SysUtils;
  116.  
  117. Const
  118.   Null = 0;
  119.  
  120. Type
  121.   {$HINTS OFF}
  122.   TIniSection = Class(TStringList)
  123.     Private
  124.         Function GetValue(Const Name: String): String;
  125.         Procedure SetValue(Const Name, Value: String);
  126.         Function FindValue(Const Name: String; Var Value: String): LongInt;
  127.         Procedure FreeItem(AObject:TObject);Override;
  128.         Property values[Const Name: String]: String Read GetValue Write SetValue;
  129.   End;
  130.   {$HINTS ON}
  131.  
  132. Function CutStr(Var S: String; C: Char): String;
  133. Var
  134.   P: Integer;
  135. Begin
  136.   P := Pos(C, S);
  137.   If P = 0 Then
  138.   Begin
  139.     Result := S;
  140.     SetLength(S, 0);
  141.   End
  142.   Else
  143.   Begin
  144.     Result := Copy(S, 1, P - 1);
  145.     Delete(S, 1, P);
  146.   End;
  147. End;
  148.  
  149. Function TrimStr(Const S: String): String;
  150. Var
  151.   L, R: Integer;
  152. Begin
  153.   R := Length(S);
  154.   While (R > 0) And (S[R] = ' ') Do Dec(R);
  155.   L := 1;
  156.   While (L <= R) And (S[L] = ' ') Do Inc(L);
  157.   Result := Copy(S, L, R - L + 1);
  158. End;
  159.  
  160. Function GetDefaultINI: String;
  161. Begin
  162.   Result := ExpandFileName(ChangeFileExt(ParamStr(0), '.INI'));
  163. End;
  164.  
  165. { TIniSection }
  166.  
  167. Procedure TIniSection.FreeItem(AObject:TObject);
  168. Var
  169.   P: PString;
  170. Begin
  171.   P := PString(AObject);
  172.   DisposeStr(P);
  173.   Inherited FreeItem(AObject);
  174. End;
  175.  
  176. {Procedure TIniSection.Put(Index: LongInt; Const S: String);
  177. Var
  178.   Ident, Value: String;
  179. Begin
  180.   Value := S;
  181.   Ident := CutStr(Value, '=');
  182.   SetValue(Ident, Value);
  183. End;}
  184.  
  185. Function TIniSection.GetValue(Const Name: String): String;
  186. Var
  187.   I: LongInt;
  188. Begin
  189.   If Find(Name, I) Then Result := PString(Objects[I])^
  190.   Else Result := '';
  191. End;
  192.  
  193. Function TIniSection.FindValue(Const Name: String; Var Value: String): LongInt;
  194. Begin
  195.   If Find(Name, Result) Then Value := PString(Objects[Result])^
  196.   Else
  197.   Begin
  198.     Value := '';
  199.     Result := -1;
  200.   End;
  201. End;
  202.  
  203. Procedure TIniSection.SetValue(Const Name, Value: String);
  204. Var
  205.   I: LongInt;
  206.   P: PString;
  207.   OldSorted: Boolean;
  208. Begin
  209.   If Find(Name, I) Then
  210.   Begin
  211.     P := PString(Objects[I]);
  212.     DisposeStr(P);
  213.     PutObject(I, TObject(NewStr(Value)));
  214.   End
  215.   Else
  216.   Begin
  217.     OldSorted := sorted;
  218.     sorted := False;
  219.     InsertObject(I, Name, TObject(NewStr(Value)));
  220.     sorted := OldSorted;
  221.   End;
  222. End;
  223.  
  224. { TIniFile }
  225.  
  226. Constructor TIniFile.Create(Const FileName: String);
  227. Begin
  228.   {$IFDEF OS2}
  229.   FHandle := PrfOpenProfile(AppHandle, FileName);
  230.   If FHandle = Null Then Error(LoadNLSStr(SCannotOpenIniFile)+'.');
  231.   {$ENDIF}
  232.   FFileName := NewStr(FileName);
  233. End;
  234.  
  235. Destructor TIniFile.Destroy;
  236. Begin
  237.   {$IFDEF OS2}
  238.   PrfCloseProfile(FHandle);
  239.   {$ENDIF}
  240.   DisposeStr(FFileName);
  241.  
  242.   Inherited Destroy;
  243. End;
  244.  
  245. Procedure TIniFile.Erase(Const section, Ident: String);
  246. Begin
  247.   {$IFDEF OS2}
  248.   PrfWriteProfileString(FHandle, section, Ident, Nil);
  249.   {$ENDIF}
  250.   {$IFDEF Win95}
  251.   WritePrivateProfileString(section,Ident,Nil,FileName);
  252.   {$ENDIF}
  253. End;
  254.  
  255. Procedure TIniFile.EraseSection(Const section: String);
  256. Begin
  257.   {$IFDEF OS2}
  258.   PrfWriteProfileString(FHandle, section, Nil, Nil);
  259.   {$ENDIF}
  260.   {$IFDEF Win95}
  261.   WritePrivateProfileString(section,Nil,Nil,FileName);
  262.   {$ENDIF}
  263. End;
  264.  
  265. Procedure TIniFile.Error(Const Msg: String);
  266. Begin
  267.   Raise EIniFileError.Create(Msg);
  268. End;
  269.  
  270. Function TIniFile.GetFileName: String;
  271. Begin
  272.   Result := FFileName^;
  273. End;
  274.  
  275. Function TIniFile.ReadString(Const section, Ident, Default: String): String;
  276. Var
  277.   OutBuf: cstring;
  278. Begin
  279.   {$IFDEF OS2}
  280.   Fillchar(OutBuf, 255, 0); {sometimes the #0 character is not copied (cdp.ini)}
  281.   PrfQueryProfileString(FHandle, Section, Ident, Default, OutBuf, 255);
  282.   Result := OutBuf;
  283.   {$ENDIF}
  284.   {$IFDEF Win95}
  285.   SetLength(Result,GetPrivateProfileString(
  286.     Section,Ident,Default,cstring(Result[1]),255,FileName));
  287.   {$ENDIF}
  288. End;
  289.  
  290. Function TIniFile.ReadInteger(Const section, Ident: String; Default: LongInt): LongInt;
  291. Begin
  292.   {$IFDEF OS2}
  293.   Result := PrfQueryProfileInt(FHandle, section, Ident, Default);
  294.   {$ENDIF}
  295.   {$IFDEF Win95}
  296.   Result := GetPrivateProfileInt(section,Ident,Default,FileName);
  297.   {$ENDIF}
  298. End;
  299.  
  300. Function TIniFile.ReadBool(Const section, Ident: String; Default: Boolean): Boolean;
  301. Var
  302.   L: LongInt;
  303. Begin
  304.   If Default Then L := 1 Else L := 0;
  305.   {$IFDEF OS2}
  306.   Result := (PrfQueryProfileInt(FHandle, section, Ident, L) <> 0);
  307.   {$ENDIF}
  308.   {$IFDEF Win95}
  309.   Result := (GetPrivateProfileInt(section,Ident,L,FileName) <> 0);
  310.   {$ENDIF}
  311. End;
  312.  
  313. Procedure TIniFile.ReadSection(Const section: String; AStrings: TStrings);
  314. Var
  315.   Size, RealSize: LongWord;
  316.   Buffer, Pos: PChar;
  317.   S: String;
  318. Begin
  319.   {$IFDEF OS2}
  320.   If Not PrfQueryProfileSize(FHandle, section, Nil, Size) Then Exit;
  321.   If Size=0 Then exit;
  322.   {$ENDIF}
  323.   {$IFDEF Win95}
  324.   //??????????????????????????????????????????????????????????
  325.   Size:=8192;
  326.   {$ENDIF}
  327.   GetMem(Buffer, Size);
  328.   Try
  329.     {$IFDEF OS2}
  330.     PrfQueryProfileString(FHandle, section, Nil, Nil, Buffer^, Size);
  331.     Buffer[Size - 1] := #0;
  332.     {$ENDIF}
  333.     {$IFDEF Win95}
  334.     Buffer[GetPrivateProfileString(section,Nil,Nil,Buffer^,Size,FileName)-1] := #0;
  335.     {$ENDIF}
  336.     Pos := Buffer;
  337.     While Pos[0] <> #0 Do
  338.     Begin
  339.       S := StrPas(Pos);
  340.       Inc(Pos, Length(S) + 1);
  341.       Dec(RealSize, Length(S) + 1);
  342.       AStrings.Add(S);
  343.     End;
  344.   Finally
  345.     FreeMem(Buffer, Size);
  346.   End;
  347. End;
  348.  
  349. Procedure TIniFile.ReadSectionValues(Const section: String; AStrings: TStrings);
  350. Var
  351.   Temp: TIniSection;
  352.   I: LongInt;
  353. Begin
  354.   Temp := TIniSection.Create;
  355.   Temp.sorted := True;
  356.   Temp.Duplicates := dupIgnore;
  357.   Try
  358.     ReadSection(section, Temp);
  359.     For I := 0 To Temp.Count - 1 Do
  360.       AStrings.values[Temp.Strings[I]]:=ReadString(section, Temp.Strings[I], '');
  361.   Finally
  362.     Temp.Destroy;
  363.   End;
  364. End;
  365.  
  366. Procedure TIniFile.WriteString(Const section, Ident, Value: String);
  367. Var
  368.   CSection, CIdent, CValue: cstring[256];
  369. Begin
  370.   CSection := section;
  371.   CIdent := Ident;
  372.   CValue := Value;
  373.   {$IFDEF OS2}
  374.   If Not PrfWriteProfileString(FHandle, CSection, CIdent, CValue) Then
  375.     Error(LoadNLSStr(SWriteError)+'.');
  376.   {$ENDIF}
  377.   {$IFDEF Win95}
  378.   If Not WritePrivateProfileString(CSection,CIdent,CValue,FileName) Then
  379.     Error(LoadNLSStr(SWriteError)+'.');
  380.   {$ENDIF}
  381. End;
  382.  
  383. Procedure TIniFile.WriteInteger(Const section, Ident: String; Value: LongInt);
  384. Begin
  385.   WriteString(section, Ident, IntToStr(Value));
  386. End;
  387.  
  388. Procedure TIniFile.WriteBool(Const section, Ident: String; Value: Boolean);
  389. Var
  390.   C: Char;
  391. Begin
  392.   If Value Then C := '1' Else C := '0';
  393.   WriteString(section, Ident, C);
  394. End;
  395.  
  396. { TAsciiIniFile }
  397.  
  398. Constructor TAsciiIniFile.Create(Const FileName: String);
  399. Var
  400.   Source: Text;
  401.   S, T: String;
  402. Begin
  403.   SectionSort := False;
  404.   IdentSort := False;
  405.  
  406.   InitIniFile;
  407.  
  408.   FSections := TStringList.Create;
  409.   FSections.Duplicates := dupIgnore;
  410.   FSections.sorted := SectionSort;
  411.   TrueString := 'True';
  412.   FalseString := 'False';
  413.  
  414.   FFileName := NewStr(FileName);
  415.   FName := NullStr;
  416.  
  417.   If FFileName <> NullStr Then
  418.   Begin
  419.     Assign(Source, FileName);
  420.     {$I-}
  421.     Reset(Source);
  422.     {$I+}
  423.     If IOResult = 0 Then
  424.     Begin
  425.       While Not Eof(Source) Do
  426.       Begin
  427.         ReadLn(Source, S);
  428.         If Length(S) <> 0 Then
  429.         Begin
  430.           If S[1] = '[' Then
  431.           Begin
  432.             { New section }
  433.             Delete(S, 1, 1);
  434.             WriteToSection(CutStr(S, ']'));
  435.           End
  436.           Else
  437.           If Not (S[1] In [';', '#', '%']) Then
  438.           Begin
  439.             { New entry }
  440.             If FList = Nil Then WriteToSection('');
  441.             T := CutStr(S, '=');
  442.             FList.AddObject(TrimStr(T), TObject(NewStr(TrimStr(S))));
  443.           End;
  444.         End;
  445.       End;
  446.       Close(Source);
  447.     End
  448.     Else
  449.     Begin
  450.       {$I-}
  451.       Rewrite(Source);
  452.       {$I+}
  453.       If IOResult = 0 Then
  454.       Begin
  455.         Close(Source);
  456.         {Delete the 0 Byte dummy}
  457.         Assign(Source, FileName);
  458.         {$I-}
  459.         System.Erase(Source);
  460.         {$I+}
  461.       End
  462.       Else Error(LoadNLSStr(SCannotOpenIniFile)+'.')
  463.     End;
  464.   End;
  465. End;
  466.  
  467. {To Setup the Sort Value Of section And Ident}
  468. Procedure TAsciiIniFile.InitIniFile;
  469. Begin
  470. End;
  471.  
  472. Destructor TAsciiIniFile.Destroy;
  473. Var
  474.   I: LongInt;
  475. Begin
  476.   Refresh;
  477.   DisposeStr(FName);
  478.   DisposeStr(FFileName);
  479.   For I := 0 To FSections.Count - 1 Do
  480.   Begin
  481.     FList := TIniSection(FSections.Objects[I]);
  482.     FList.Destroy;
  483.   End;
  484.   FSections.Destroy;
  485. End;
  486.  
  487. Procedure TAsciiIniFile.Erase(Const section, Ident: String);
  488. Var
  489.   I: LongInt;
  490. Begin
  491.   If ReadFromSection(section) Then
  492.   Begin
  493.     If FList.Find(Ident, I) Then
  494.     Begin
  495.       FList.Delete(I);
  496.       FChanged := True;
  497.     End;
  498.   End;
  499. End;
  500.  
  501. Procedure TAsciiIniFile.EraseSection(Const section: String);
  502. Var
  503.   I: LongInt;
  504.   S: TIniSection;
  505. Begin
  506.   If FSections.Find(section, I) Then
  507.   Begin
  508.     S := TIniSection(FSections.Objects[I]);
  509.     S.Destroy;
  510.     FSections.Delete(I);
  511.     If S = FList Then
  512.     Begin
  513.       AssignStr(FName, '');
  514.       FList := Nil;
  515.     End;
  516.     FChanged := True;
  517.   End;
  518. End;
  519.  
  520. Procedure TAsciiIniFile.WriteToSection(Const section: String);
  521. Var
  522.   I: LongInt;
  523. Begin
  524.   If CompareText(section, FName^) <> 0 Then
  525.   Begin
  526.     If FSections.Find(section, I) Then
  527.     Begin
  528.       AssignStr(FName, section);
  529.       FList := TIniSection(FSections.Objects[I]);
  530.     End
  531.     Else
  532.     Begin
  533.       FList := TIniSection.Create;
  534.       FList.Duplicates := dupAccept;
  535.       FList.sorted := IdentSort;
  536.       FList.CaseSensitive := False;
  537.       FSections.AddObject(section, FList);
  538.       AssignStr(FName, section);
  539.     End;
  540.   End;
  541. End;
  542.  
  543. Function TAsciiIniFile.ReadFromSection(Const section: String): Boolean;
  544. Var
  545.   I: LongInt;
  546. Begin
  547.   Result := True; {!}
  548.   If CompareText(section, FName^) <> 0 Then
  549.   Begin
  550.     If FSections.Find(section, I) Then
  551.     Begin
  552.       AssignStr(FName, section);
  553.       FList := TIniSection(FSections.Objects[I]);
  554.     End
  555.     Else Result := False; {!}
  556.   End;
  557. //  Result := (FList <> Nil);
  558.   {liefert sonst Die Letzte zurück, wenn section unbekannt}
  559. End;
  560.  
  561. {Function TAsciiIniFile.GetFileName: String;
  562. Begin
  563.   Result := FFileName^;
  564. End;}
  565.  
  566. Function TAsciiIniFile.ReadBool(Const section, Ident: String; Default: Boolean): Boolean;
  567. Var
  568.   S: String;
  569. Begin
  570.   If ReadFromSection(section) Then
  571.   With TIniSection(FList) { As TIniSection} Do
  572.   Begin
  573.     If FindValue(Ident, S) = -1 Then Result := Default
  574.     Else
  575.     Begin
  576.       If CompareText(S, TrueString) = 0 Then Result := True
  577.       Else If CompareText(S, FalseString) = 0 Then Result := False
  578.       Else Result := Default;
  579.     End;
  580.   End
  581.   Else Result := Default;
  582. End;
  583.  
  584. Function TAsciiIniFile.ReadInteger(Const section, Ident: String; Default: LongInt): LongInt;
  585. Var
  586.   S: String;
  587. Begin
  588.   If ReadFromSection(section) Then
  589.   With TIniSection(FList) { As TIniSection} Do
  590.   Begin
  591.     If FindValue(Ident, S) = -1 Then Result := Default
  592.     Else Result := StrToIntDef(S, Default);
  593.   End
  594.   Else Result := Default;
  595. End;
  596.  
  597. Function TAsciiIniFile.ReadString(Const section, Ident, Default: String): String;
  598. Begin
  599.   If ReadFromSection(section) Then
  600.   With TIniSection(FList) { As TIniSection} Do
  601.   Begin
  602.     If FindValue(Ident, Result) = -1 Then Result := Default;
  603.   End
  604.   Else Result := Default;
  605. End;
  606.  
  607. Procedure TAsciiIniFile.ReadSection(Const section: String; AStrings: TStrings);
  608. Var
  609.   N: LongInt;
  610. Begin
  611.   If ReadFromSection(section) Then
  612.   Begin
  613.     For N := 0 To FList.Count - 1 Do AStrings.Add(FList.Strings[N]);
  614.   End;
  615. End;
  616.  
  617. Procedure TAsciiIniFile.ReadSections(AStrings: TStrings);
  618. Var
  619.   N: LongInt;
  620. Begin
  621.   For N := 0 To FSections.Count - 1 Do AStrings.Add(FSections.Strings[N]);
  622. End;
  623.  
  624. Procedure TAsciiIniFile.ReadSectionValues(Const section: String; AStrings: TStrings);
  625. Var
  626.   N: LongInt;
  627. Begin
  628.   If ReadFromSection(section) Then
  629.   Begin
  630.     For N := 0 To FList.Count - 1 Do
  631.       AStrings.Add(FList.Strings[N] + '=' + PString(FList.Objects[N])^);
  632.   End;
  633. End;
  634.  
  635. Procedure TAsciiIniFile.Refresh;
  636. Var
  637.   Dest: Text;
  638.   N, I: LongInt;
  639.   L: TIniSection;
  640.   S: String;
  641. Begin
  642.   If FChanged And (FFileName <> NullStr) Then
  643.   Begin
  644.     Assign(Dest, FileName);
  645.     Rewrite(Dest);
  646.     For N := 0 To FSections.Count - 1 Do
  647.     Begin
  648.       S := FSections.Strings[N];
  649.       If Length(S) <> 0 Then
  650.       Begin
  651.         WriteLn(Dest, '[' + S + ']');
  652.         WriteLn(Dest);
  653.       End;
  654.       L := TIniSection(FSections.Objects[N]);
  655.       For I := 0 To L.Count - 1 Do
  656.         WriteLn(Dest, L.Strings[I], '=', PString(L.Objects[I])^);
  657.       If N < FSections.Count Then WriteLn(Dest);
  658.       FChanged := False;
  659.     End;
  660.     Close(Dest);
  661.   End;
  662. End;
  663.  
  664. Procedure TAsciiIniFile.WriteBool(Const section, Ident: String; Value: Boolean);
  665. Begin
  666.   FChanged := True;
  667.   WriteToSection(section);
  668.   If Value Then TIniSection(FList).values[Ident]:=TrueString
  669.   Else TIniSection(FList).values[Ident]:=FalseString;
  670. End;
  671.  
  672. Procedure TAsciiIniFile.WriteInteger(Const section, Ident: String; Value: LongInt);
  673. Begin
  674.   FChanged := True;
  675.   WriteToSection(section);
  676.   TIniSection(FList).values[Ident]:=IntToStr(Value);
  677. End;
  678.  
  679. Procedure TAsciiIniFile.WriteString(Const section, Ident, Value: String);
  680. Begin
  681.   FChanged := True;
  682.   WriteToSection(section);
  683.   TIniSection(FList).values[Ident]:=Value;
  684. End;
  685.  
  686. End.
  687.  
  688. { Änderungen: 26.11.95  Sections werden sortiert, Einträge aber nicht
  689.               28.11.95  alles wird sortiert, schneller durch Trennung
  690.                         von Ident und Value (TIniSection).
  691.               30.11.95  Fehler In TIniSection korrigiert, ES
  692.                         fehlten Get/Put
  693.               16.12.95  neue Funktion GetDefaultINI()
  694.               16-Aug-97   Jörg: Bugfix for TIniFile.ReadString.
  695.  
  696.   To-Do: - Eventuell ReadData / WriteData einbauen
  697.          - Eventuell ReadSectionNames einbauen = ReadSections
  698.          - wenn String -> cstring Fehler In SP/2 behoben,
  699.            Workaround entfernen.
  700. }
  701.  
  702.  
  703.  
  704.