| Creatixy wrote: |
| ask him? how? |
Code: Show/Hide //procedure that reads the ini into several arrays
procedure TMainFrm.Open(Datei:String); var f: TextFile; section,Flag,i: integer; Line,Help: string; begin MapCount := 0; ScreenCount := 0; ImageCount := 0; section := 0; AssignFile(f,Datei); Reset(f); while not EOF(f) do begin Flag := 0; ReadLn(f,Line); If (LowerCase(Copy(Line,1,7)) = 'outfile') then begin eOutFile.Text := Copy(Line,9,Length(Line)-8); end; If (LowerCase(Copy(Line,1,4)) = 'file') then begin FileList.Items.Add(Copy(Line,6,Length(Line)-5)); end; If (LowerCase(Copy(Line,1,14)) = '[objectimages]') then begin section := 1; Flag := 1; end; If (LowerCase(Copy(Line,1,12)) = '[mapobjects]') then begin section := 2; Flag := 1; end; If (LowerCase(Copy(Line,1,15)) = '[screenobjects]') then begin section := 3; Flag := 1; end; If (Flag = 0) then begin if (section = 1) and (Copy(Line,1,1) <> ';') and (Length(Line) <> 0) then begin // ObjectImages ImageCount := ImageCount + 1; {Get ImageNumber} Help := ''; For i := 1 to Length(Line) do begin Help := Help + Copy(Line,i,1); If Copy(Line,i,1) = '=' then begin Help := Copy(Help,1,Length(Help)-1); Help := Copy(Help,6,Length(Help)-5); SetLength(Images,ImageCount); SetLength(ImageT,ImageCount); SetLength(ImageY,ImageCount); SetLength(ImageX,ImageCount); SetLength(ImageFile,ImageCount); Images[ImageCount-1] := StrToInt(Help); ImageBox.Items.Add('IMAGE'+IntToStr(Images[ImageCount-1])); end; end; {Get File of the Image} Help := GetImageFile(Line); ImageFile[ImageCount-1] := Help; {Other attributes} ImageX[ImageCount-1] := GetOption(Line,1,True); ImageY[ImageCount-1] := GetOption(Line,2,True); ImageT[ImageCount-1] := GetOption(Line,3,True); end; if (section = 2) and (Copy(Line,1,1) <> ';') and (Length(Line) <> 0) then begin // MapObjects MapObjectList.Items.Add(Line); MapCount := MapCount + 1; SetLength(MapX,MapCount); SetLength(MapY,MapCount); SetLength(MapImage,MapCount); SetLength(MapLayer,MapCount); SetLength(MapMode,MapCount); SetLength(MapTime,MapCount); SetLength(MapID,MapCount); MapX[MapCount-1] := IntToStr(GetOption(Line,0,False)); MapY[MapCount-1] := IntToStr(GetOption(Line,1,False)); MapImage[MapCount-1] := GetOption(Line,2,False); MapLayer[MapCount-1] := GetOption(Line,3,False); MapMode[MapCount-1] := GetOption(Line,4,False); MapTime[MapCount-1] := GetOption(Line,5,False); MapID[MapCount-1] := GetOption(Line,6,False); end; if (section = 3) and (Copy(Line,1,1) <> ';') and (Length(Line) <> 0) then begin // ScreenObjects ScreenObjectList.Items.Add(Line); ScreenCount := ScreenCount + 1; SetLength(ScreenX,ScreenCount); SetLength(ScreenY,ScreenCount); SetLength(ScreenImage,ScreenCount); SetLength(ScreenLayer,ScreenCount); SetLength(ScreenMode,ScreenCount); SetLength(ScreenTime,ScreenCount); SetLength(ScreenID,ScreenCount); ScreenX[ScreenCount-1] := GetObjectXY(Line,0); ScreenY[ScreenCount-1] := GetObjectXY(Line,1); ScreenImage[ScreenCount-1] := GetOption(Line,2,False); ScreenLayer[ScreenCount-1] := GetOption(Line,3,False); ScreenMode[ScreenCount-1] := GetOption(Line,4,False); ScreenTime[ScreenCount-1] := GetOption(Line,5,False); ScreenID[ScreenCount-1] := GetOption(Line,6,False); end; end; end; CloseFile(f); end; |