Changeset 313 for trunk/Packages/Common/UCommon.pas
- Timestamp:
- Jan 18, 2022, 10:45:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UCommon.pas
r310 r313 6 6 7 7 uses 8 {$ ifdef Windows}Windows,{$endif}9 {$ ifdef Linux}baseunix,{$endif}8 {$IFDEF WINDOWS}Windows,{$ENDIF} 9 {$IFDEF UNIX}baseunix,{$ENDIF} 10 10 Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, 11 11 FileUtil; //, ShFolder, ShellAPI; … … 35 35 DLLHandle1: HModule; 36 36 37 {$IFDEF W indows}37 {$IFDEF WINDOWS} 38 38 GetUserNameEx: procedure (NameFormat: DWORD; 39 39 lpNameBuffer: LPSTR; nSize: PULONG); stdcall; … … 85 85 function TryHexToInt(Data: string; var Value: Integer): Boolean; 86 86 function TryBinToInt(Data: string; var Value: Integer): Boolean; 87 procedure SortStrings(Strings: TStrings); 87 88 88 89 … … 291 292 function Explode(Separator: char; Data: string): TArrayOfString; 292 293 begin 294 Result := nil; 293 295 SetLength(Result, 0); 294 296 while Pos(Separator, Data) > 0 do begin … … 345 347 Name: UtsName; 346 348 begin 349 Name := Default(UtsName); 347 350 fpuname(Name); 348 351 Result := Name.Nodename; … … 504 507 I: Integer; 505 508 begin 509 Result := Default(TArrayOfString); 506 510 SetLength(Result, Length(A) + Length(B)); 507 511 for I := 0 to Length(A) - 1 do … … 677 681 end; 678 682 683 procedure SortStrings(Strings: TStrings); 684 var 685 Tmp: TStringList; 686 begin 687 Strings.BeginUpdate; 688 try 689 if Strings is TStringList then begin 690 TStringList(Strings).Sort; 691 end else begin 692 Tmp := TStringList.Create; 693 try 694 Tmp.Assign(Strings); 695 Tmp.Sort; 696 Strings.Assign(Tmp); 697 finally 698 Tmp.Free; 699 end; 700 end; 701 finally 702 Strings.EndUpdate; 703 end; 704 end; 705 679 706 680 707 initialization
Note:
See TracChangeset
for help on using the changeset viewer.