Changeset 156 for oup/current/DataAccess


Ignore:
Timestamp:
Apr 2, 2007, 12:49:17 AM (18 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/DataAccess/Access_OUP_ADB.pas

    r155 r156  
    4747
    4848uses
    49   SysUtils, Data, Functions, ABSDecUtil, DB, DatLinks;
     49  SysUtils, Data, Functions, ABSDecUtil, DB, DatLinks, StrUtils;
    5050
    5151
     
    214214
    215215
     216  function CompareItems(List: TStringList; I1, I2: Integer): Integer;
     217  var
     218    fin: Boolean;
     219    pos: Integer;
     220    s1, s2: String;
     221  begin
     222    fin := False;
     223    s1 := MidStr(List[I1], 1, PosEx(';', List[I1], 6) - 1);
     224    s2 := MidStr(List[I2], 1, PosEx(';', List[I2], 6) - 1);
     225    pos := 1;
     226    Result := 0;
     227    repeat
     228      if Ord(s1[pos]) < Ord(s2[pos]) then
     229      begin
     230        Result := -1;
     231        fin := True;
     232      end
     233      else if Ord(s1[pos]) > Ord(s2[pos]) then
     234      begin
     235        Result := 1;
     236        fin := True;
     237      end;
     238      Inc(pos);
     239    until fin or (pos > Length(s1)) or (pos > Length(s2));
     240
     241    if not fin then
     242    begin
     243      if pos > Length(s1) then
     244        Result := -1
     245      else
     246        Result := 1;
     247    end;
     248  end;
    216249
    217250function TAccess_OUP_ADB.GetFilesList(ext: String; pattern: String;
     
    254287begin
    255288  list := TStringList.Create;
    256   list.CaseSensitive := True;
    257   list.Sorted := True;
     289  if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then
     290    list.Sorted := False
     291  else
     292    list.Sorted := True;
    258293  for i := 0 to GetFileCount - 1 do
    259294  begin
     
    277312    end;
    278313  end;
     314  if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then
     315    list.CustomSort(CompareItems);
    279316  if not Assigned(Result) then
    280317    Result := TStringList.Create;
Note: See TracChangeset for help on using the changeset viewer.