Jump to content
LordJashin

Some array INI Functions

Recommended Posts

Updated for section arrays

[sCAR]

function ReadINIArr(FileName: string; Sections, Keys: TStringArray): TStringArray;

var

i: Integer;

begin

Result := [''];

if (FileName = '') or (Length(Sections) < 1) or (Length(Keys) < 1) or (Length(Sections) <> Length(Keys)) then

Exit;

SetLength(Result, High(Sections) + 1);

for i := 0 to High(Sections) do

begin

if INIKeyExists(Sections, Keys, FileName) then

Result := ReadINI(Sections, Keys, FileName)

else

begin

Result := [''];

Exit;

end;

end;

end;

 

function WriteINIArr(FileName: string; Sections, Keys, Values: TStringArray): Boolean;

var

i: Integer;

B: Boolean;

begin

B := True;

Result := False;

if (FileName = '') or (Length(Sections) < 1) or (Length(Keys) < 1) or (Length(Values) < 1) or (Length(Keys) <> Length(Sections)) or (Length(Keys) <> Length(Values)) then

Exit;

for i := 0 to High(Sections) do

if not WriteINI(Sections, Keys, Values, FileName) then

B := False;

Result := B;

end;

 

 

function DeleteINIArr(FileName: string; Sections, Keys: TStringArray): Boolean;

var

i: Integer;

begin

Result := True;

if (FileName = '') or (Length(Sections) < 1) or (Length(Keys) < 1) or (Length(Sections) <> Length(Keys)) then

Exit;

for i := 0 to High(Sections) do

if INIKeyExists(Sections, Keys, FileName) then

DeleteINI(Sections, Keys, FileName);

else

Result := False;

end;[/sCAR]

Edited by LordJashin
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...