1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74:
| try
try progressbar1.Position := progressbar1.Position +1; aktion.Caption := 'erstelle Kundenindex...'; application.ProcessMessages; kundenfiles := TStringList.Create; country := TStringList.Create; country.Sorted := true; country.Duplicates := dupIgnore; getfilesinDirectory (contactpath,'*.con',kundenfiles,false,true); progressbar2.Max := kundenfiles.Count; setlength (kunden,0); for i := 0 to kundenfiles.Count -1 do begin land := ''; vname := ''; nname := ''; firma := ''; progressbar2.Position := i+1; if i mod 200 = 0 then application.ProcessMessages; try kunde := TIniFile.Create(kundenfiles[i]); vname := kunde.ReadString('con','vname',''); nname := kunde.ReadString('con','nname',''); firma := kunde.ReadString('con','firma',''); land := kunde.ReadString('con','land',''); if not (land = '') then country.Add(land); if (firma = '') and (nname = '') then continue; setlength (kunden,length(kunden)+1); kunden[high(kunden)].id := stringreplace (extractfilename (kundenfiles[i]),'.con','',[rfReplaceAll]); if nname = '' then begin kunden[high(kunden)].dispname := firma; kunden[high(kunden)].startchar := (AnsiUppercase(firma))[1]; end else begin kunden[high(kunden)].dispname := nname; kunden[high(kunden)].startchar := AnsiUppercase(nname)[1]; if not (vname = '') then kunden[high(kunden)].dispname := kunden[high(kunden)].dispname + ', ' + vname; end; if not (kunden[high(kunden)].startchar in ['A'..'Z','Ä','Ö','Ü']) then kunden[high(kunden)].startchar := '1'; if kunden[high(kunden)].startchar = 'Ä' then kunden[high(kunden)].startchar := 'A'; if kunden[high(kunden)].startchar = 'Ö' then kunden[high(kunden)].startchar := 'O'; if kunden[high(kunden)].startchar = 'Ü' then kunden[high(kunden)].startchar := 'U'; kunden[high(kunden)].inactive := kunde.ReadBool('con','inactive',false);
try values := TStringList.Create; temp := ''; kunde.ReadSectionValues('con',values); for j := 0 to values.Count-1 do begin temp := temp + values.ValueFromIndex[j] + ' ' ; end; kunden[high(kunden)].searchstring := temp; finally values.Free; end;
finally kunde.Free; end; end; country.SaveToFile(cachepath + 'country.dat'); finally kundenfiles.Free; country.Free; end; |