From bca312b26a1deead4c70bf46b05a02e738d373a3 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sun, 23 Sep 2012 00:59:08 -0400 Subject: [PATCH] Sequential option --- mdl/m_inireader.pas | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/mdl/m_inireader.pas b/mdl/m_inireader.pas index facc7cb..20ebeb9 100644 --- a/mdl/m_inireader.pas +++ b/mdl/m_inireader.pas @@ -6,10 +6,12 @@ Interface Type TIniReader = Class - FileName : String; - IniFile : Text; - Buffer : Array[1..1024*4] of Char; - Opened : Boolean; + FileName : String; + IniFile : Text; + Buffer : Array[1..1024*4] of Char; + Opened : Boolean; + Sequential : Boolean; + CurrentCat : String; Constructor Create (FN: String); Destructor Destroy; Override; @@ -24,8 +26,10 @@ Uses Constructor TIniReader.Create (FN: String); Begin - FileName := FN; - FileMode := 66; + Sequential := False; + CurrentCat := ''; + FileName := FN; + FileMode := 66; Assign (IniFile, FileName); SetTextBuf (IniFile, Buffer); @@ -52,21 +56,26 @@ Begin Category := strUpper(Category); Value := strUpper(Value); - Reset (IniFile); + If Not Sequential Then Reset (IniFile); - While Not GotCat And Not Eof(IniFile) Do Begin - ReadLn (IniFile, RawStr); + If Sequential and (CurrentCat = Category) Then + GotCat := True + Else + While Not GotCat And Not Eof(IniFile) Do Begin + ReadLn (IniFile, RawStr); - RawStr := strStripB(RawStr, ' '); - NewStr := strUpper(strStripLOW(RawStr)); + RawStr := strStripB(RawStr, ' '); + NewStr := strUpper(strStripLOW(RawStr)); - If (RawStr = '') or (RawStr[1] = ';') Then Continue; + If (RawStr = '') or (RawStr[1] = ';') Then Continue; - GotCat := Pos('[' + Category + ']', NewStr) > 0; - End; + GotCat := Pos('[' + Category + ']', NewStr) > 0; + End; If Not GotCat Then Exit; + CurrentCat := Category; + While Not Eof(IniFile) Do Begin ReadLn (IniFile, RawStr);