Sequential option
This commit is contained in:
parent
6a49bd147d
commit
bca312b26a
|
@ -6,10 +6,12 @@ Interface
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TIniReader = Class
|
TIniReader = Class
|
||||||
FileName : String;
|
FileName : String;
|
||||||
IniFile : Text;
|
IniFile : Text;
|
||||||
Buffer : Array[1..1024*4] of Char;
|
Buffer : Array[1..1024*4] of Char;
|
||||||
Opened : Boolean;
|
Opened : Boolean;
|
||||||
|
Sequential : Boolean;
|
||||||
|
CurrentCat : String;
|
||||||
|
|
||||||
Constructor Create (FN: String);
|
Constructor Create (FN: String);
|
||||||
Destructor Destroy; Override;
|
Destructor Destroy; Override;
|
||||||
|
@ -24,8 +26,10 @@ Uses
|
||||||
|
|
||||||
Constructor TIniReader.Create (FN: String);
|
Constructor TIniReader.Create (FN: String);
|
||||||
Begin
|
Begin
|
||||||
FileName := FN;
|
Sequential := False;
|
||||||
FileMode := 66;
|
CurrentCat := '';
|
||||||
|
FileName := FN;
|
||||||
|
FileMode := 66;
|
||||||
|
|
||||||
Assign (IniFile, FileName);
|
Assign (IniFile, FileName);
|
||||||
SetTextBuf (IniFile, Buffer);
|
SetTextBuf (IniFile, Buffer);
|
||||||
|
@ -52,21 +56,26 @@ Begin
|
||||||
Category := strUpper(Category);
|
Category := strUpper(Category);
|
||||||
Value := strUpper(Value);
|
Value := strUpper(Value);
|
||||||
|
|
||||||
Reset (IniFile);
|
If Not Sequential Then Reset (IniFile);
|
||||||
|
|
||||||
While Not GotCat And Not Eof(IniFile) Do Begin
|
If Sequential and (CurrentCat = Category) Then
|
||||||
ReadLn (IniFile, RawStr);
|
GotCat := True
|
||||||
|
Else
|
||||||
|
While Not GotCat And Not Eof(IniFile) Do Begin
|
||||||
|
ReadLn (IniFile, RawStr);
|
||||||
|
|
||||||
RawStr := strStripB(RawStr, ' ');
|
RawStr := strStripB(RawStr, ' ');
|
||||||
NewStr := strUpper(strStripLOW(RawStr));
|
NewStr := strUpper(strStripLOW(RawStr));
|
||||||
|
|
||||||
If (RawStr = '') or (RawStr[1] = ';') Then Continue;
|
If (RawStr = '') or (RawStr[1] = ';') Then Continue;
|
||||||
|
|
||||||
GotCat := Pos('[' + Category + ']', NewStr) > 0;
|
GotCat := Pos('[' + Category + ']', NewStr) > 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If Not GotCat Then Exit;
|
If Not GotCat Then Exit;
|
||||||
|
|
||||||
|
CurrentCat := Category;
|
||||||
|
|
||||||
While Not Eof(IniFile) Do Begin
|
While Not Eof(IniFile) Do Begin
|
||||||
ReadLn (IniFile, RawStr);
|
ReadLn (IniFile, RawStr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue