Changeset 249 for trunk/Components/ACLLanguageUnit.pas
- Timestamp:
- Sep 17, 2007, 9:00:30 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/ACLLanguageUnit.pas
r231 r249 48 48 function getValue(const aLabel : String; const aDefaultValue : String) : String; 49 49 procedure setValue(const aLabel : String; const aValue : String); 50 procedure readFrom(aTextFile : TextFile); 50 51 procedure saveTo(const aTextFile : TextFile); 51 52 end; … … 248 249 249 250 251 procedure TLanguageItemList.readFrom(aTextFile : TextFile); 252 var 253 tmpLine : string; 254 tmpLabel : string; 255 tmpValue : string; 256 tmpLineParts : TStringList; 257 begin 258 tmpLineParts := TStringList.Create; 259 260 while not Eof(aTextFile) do 261 begin 262 ReadLn(aTextFile, tmpLine); 263 264 tmpLineParts.clear; 265 StrExtractStringsQuoted(tmpLineParts, tmpLine); 266 267 if tmpLineParts.count > 0 then 268 begin 269 tmpLabel := tmpLineParts[0]; 270 271 // TODO trim leading blanks 272 if tmpLabel[1] <> LANGUAGE_COMMENT_CHAR then 273 begin 274 // Got a name, read the value and store. 275 tmpValue := ''; 276 if tmpLineParts.count > 0 then 277 begin 278 tmpValue := tmpLineParts[1]; 279 end; 280 281 setValue(tmpLabel, tmpValue); 282 end; 283 end; 284 end; 285 286 tmpLineParts.Destroy; 287 end; 288 289 250 290 procedure TLanguageItemList.saveTo(const aTextFile : TextFile); 251 291 var … … 459 499 var 460 500 tmpTextFile : TextFile; 461 tmpLine : string;462 tmpLabel : string;463 tmpValue : string;464 tmpLineParts : TStringList;465 501 begin 466 502 filename := aFileName; … … 478 514 Reset(tmpTextFile); 479 515 480 tmpLineParts := TStringList.Create; 481 482 while not Eof(tmpTextFile) do 483 begin 484 ReadLn(tmpTextFile, tmpLine); 485 486 tmpLineParts.clear; 487 StrExtractStringsQuoted(tmpLineParts, tmpLine); 488 489 if tmpLineParts.count > 0 then 490 begin 491 tmpLabel := tmpLineParts[0]; 492 493 // TODO trim leading blanks 494 if tmpLabel[1] <> LANGUAGE_COMMENT_CHAR then 495 begin 496 // Got a name, read the value and store. 497 tmpValue := ''; 498 if tmpLineParts.count > 0 then 499 begin 500 tmpValue := tmpLineParts[1]; 501 end; 502 503 languageItems.setValue(tmpLabel, tmpValue); 504 end; 505 end; 506 end; 507 508 tmpLineParts.Destroy; 516 languageItems.readFrom(tmpTextFile); 517 509 518 CloseFile(tmpTextFile); 510 519 end;
Note:
See TracChangeset
for help on using the changeset viewer.