Ignore:
Timestamp:
Jan 18, 2022, 10:45:33 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Updated to build under Lazarus 2.2.0.
  • Modified: Updated Common package to version 0.9.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UCommon.pas

    r310 r313  
    66
    77uses
    8   {$ifdef Windows}Windows,{$endif}
    9   {$ifdef Linux}baseunix,{$endif}
     8  {$IFDEF WINDOWS}Windows,{$ENDIF}
     9  {$IFDEF UNIX}baseunix,{$ENDIF}
    1010  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
    1111  FileUtil; //, ShFolder, ShellAPI;
     
    3535  DLLHandle1: HModule;
    3636
    37 {$IFDEF Windows}
     37{$IFDEF WINDOWS}
    3838  GetUserNameEx: procedure (NameFormat: DWORD;
    3939    lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
     
    8585function TryHexToInt(Data: string; var Value: Integer): Boolean;
    8686function TryBinToInt(Data: string; var Value: Integer): Boolean;
     87procedure SortStrings(Strings: TStrings);
    8788
    8889
     
    291292function Explode(Separator: char; Data: string): TArrayOfString;
    292293begin
     294  Result := nil;
    293295  SetLength(Result, 0);
    294296  while Pos(Separator, Data) > 0 do begin
     
    345347  Name: UtsName;
    346348begin
     349  Name := Default(UtsName);
    347350  fpuname(Name);
    348351  Result := Name.Nodename;
     
    504507  I: Integer;
    505508begin
     509  Result := Default(TArrayOfString);
    506510  SetLength(Result, Length(A) + Length(B));
    507511  for I := 0 to Length(A) - 1 do
     
    677681end;
    678682
     683procedure SortStrings(Strings: TStrings);
     684var
     685  Tmp: TStringList;
     686begin
     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;
     704end;
     705
    679706
    680707initialization
Note: See TracChangeset for help on using the changeset viewer.