Changeset 241 for oup/current/DataAccess


Ignore:
Timestamp:
Jul 18, 2007, 12:27:16 AM (17 years ago)
Author:
alloc
Message:
 
Location:
oup/current/DataAccess
Files:
3 edited

Legend:

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

    r229 r241  
    3535    function GetRawList(FileID: Integer): TRawDataList; override;
    3636    function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override;
     37    function GetRawsForType(RawType: String): TRawDataList; override;
    3738
    3839    procedure LoadRawFile(FileID, DatOffset: Integer; var Target: TStream); overload; override;
     
    268269  else
    269270    list.Sorted := True;
     271  if ext = '*' then
     272    ext := '';
    270273  for i := 0 to GetFileCount - 1 do
    271274  begin
     
    490493begin
    491494  SetLength(Result, 0);
    492   FQuery.SQL.Text := 'SELECT [src_link_offset],[size],[sep] FROM rawmap WHERE [src_id]=' +
     495  FQuery.SQL.Text := 'SELECT [src_link_offset],[name],[size],[sep],[type] FROM rawmap WHERE [src_id]=' +
    493496    IntToStr(fileid) + ' ORDER BY src_link_offset ASC;';
    494497  FQuery.Open;
     
    499502    i := 0;
    500503    repeat
     504      Result[i].Name      := FQuery.FieldByName('name').AsString;
    501505      Result[i].SrcID     := fileid;
    502506      Result[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
     
    504508      Result[i].RawSize   := FQuery.FieldByName('size').AsInteger;
    505509      Result[i].LocSep    := FQuery.FieldByName('sep').AsBoolean;
     510      Result[i].RawType   := FQuery.FieldByName('type').AsString;
    506511      Inc(i);
    507512      FQuery.Next;
     
    526531      Result := rawlist[i]
    527532    else begin
     533      Result.Name      := '';
    528534      Result.SrcID     := -1;
    529535      Result.SrcOffset := -1;
    530536      Result.RawAddr   := -1;
    531537      Result.RawSize   := -1;
    532     end;
    533   end;
    534 end;
     538      Result.RawType   := '';
     539    end;
     540  end;
     541end;
     542
     543
     544function TAccess_OUP_ADB.GetRawsForType(RawType: String): TRawDataList;
     545var
     546  i: Integer;
     547  rawlist: TRawDataList;
     548begin
     549  SetLength(Result, 0);
     550  FQuery.SQL.Text := 'SELECT [src_id],[src_link_offset],[name],[size],[sep] FROM rawmap ' +
     551    'WHERE [type]="' + RawType + '" ORDER BY src_id ASC, src_link_offset ASC;';
     552  FQuery.Open;
     553  if FQuery.RecordCount > 0 then
     554  begin
     555    FQuery.First;
     556    SetLength(Result, FQuery.RecordCount);
     557    i := 0;
     558    repeat
     559      Result[i].Name      := FQuery.FieldByName('name').AsString;
     560      Result[i].SrcID     := FQuery.FieldByName('src_id').AsInteger;
     561      Result[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
     562      Result[i].RawAddr   := 0;
     563      Result[i].RawSize   := FQuery.FieldByName('size').AsInteger;
     564      Result[i].LocSep    := FQuery.FieldByName('sep').AsBoolean;
     565      Result[i].RawType   := RawType;
     566      Inc(i);
     567      FQuery.Next;
     568    until FQuery.EOF;
     569  end;
     570  FQuery.Close;
     571end;
     572
    535573
    536574
  • oup/current/DataAccess/Access_OniArchive.pas

    r231 r241  
    3939    function GetRawList(FileID: Integer): TRawDataList; override;
    4040    function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override;
     41    function GetRawsForType(RawType: String): TRawDataList; override;
    4142
    4243    procedure LoadRawOffset(LocSep: Boolean; RawAddr, Size: Integer; var target: TStream); overload;
     
    285286  list := TStringList.Create;
    286287  list.Sorted := True;
     288  if ext = '*' then
     289    ext := '';
    287290  for i := 0 to GetFileCount - 1 do
    288291  begin
     
    489492begin
    490493  Result := RawLists.GetRawList(FConnectionID, FileID);
     494end;
     495
     496
     497function TAccess_OniArchive.GetRawsForType(RawType: String): TRawDataList;
     498var
     499  i, j: Integer;
     500  dats: TStrings;
     501  list: TRawDataList;
     502begin
     503  dats := nil;
     504  dats := GetFilesList(MidStr(RawType, 1, 4), '', True, ST_IDAsc);
     505  for i := 0 to dats.Count - 1 do
     506  begin
     507    list := GetRawList(StrToInt(MidStr(dats.Strings[i], 1, 5)));
     508    for j := 0 to Length(list) - 1 do
     509    begin
     510      if list[j].RawType = RawType then
     511      begin
     512        SetLength(Result, Length(Result)+1);
     513        Result[High(Result)] := list[j];
     514      end;
     515    end;
     516  end;
    491517end;
    492518
  • oup/current/DataAccess/DataAccess.pas

    r229 r241  
    5050    function GetRawList(FileID: Integer): TRawDataList; virtual; abstract;
    5151    function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; virtual; abstract;
     52    function GetRawsForType(RawType: String): TRawDataList; virtual; abstract;
    5253
    5354    procedure LoadRawFile(FileID, DatOffset: Integer; var Target: TStream); overload; virtual; abstract;
Note: See TracChangeset for help on using the changeset viewer.