Changeset 105 for oup/rewrite/DataAccess


Ignore:
Timestamp:
Feb 21, 2007, 1:29:27 AM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/rewrite/DataAccess
Files:
3 edited

Legend:

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

    r101 r105  
    103103  FBackend := DB_ADB;
    104104
     105  FConnectionID := ConnectionID;
    105106  FChangeRights := [CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw];
    106107
  • oup/rewrite/DataAccess/Access_OniArchive.pas

    r101 r105  
    4343    procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TStream); overload; override;
    4444
    45     function AppendRawFile(LocSep: Boolean; Size: Integer; Src: TStream): Integer; overload; override;
     45    function AppendRawFile(LocSep: Boolean; Src: TStream): Integer; overload; override;
    4646  published
    4747  end;
     
    184184  Msg := SM_OK;
    185185  FBackend := DB_ONI;
     186  FConnectionID := ConnectionID;
    186187  FChangeRights := [CR_EditDat, CR_EditRaw, CR_AppendRaw];
    187188end;
     
    616617end;
    617618
    618 function TAccess_OniArchive.AppendRawFile(LocSep: Boolean; Size: Integer; Src: TStream): Integer;
     619function TAccess_OniArchive.AppendRawFile(LocSep: Boolean; Src: TStream): Integer;
    619620begin
    620621  if not LocSep then
     
    625626    Result := Fraw_file.Size;
    626627    Fraw_file.Seek(0, soFromEnd);
    627     Fraw_file.CopyFrom(Src, Size);
     628    Fraw_file.CopyFrom(Src, Src.Size);
    628629    if UnloadWhenUnused then
    629630    begin
     
    641642    Result := Fsep_file.Size;
    642643    Fsep_file.Seek(0, soFromEnd);
    643     Fsep_file.CopyFrom(Src, Size);
     644    Fsep_file.CopyFrom(Src, Src.Size);
    644645    if UnloadWhenUnused then
    645646    begin
  • oup/rewrite/DataAccess/DataAccess.pas

    r101 r105  
    4242    procedure LoadDatFilePart(FileID, Offset, Size: Integer; Target: Pointer); overload;
    4343    procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TStream); overload; virtual; abstract;
    44     procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TByteData); overload;
    4544    procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: Pointer); overload;
    4645
     
    5655    procedure LoadRawFilePart(FileID, DatOffset, Offset, Size: Integer; Target: Pointer); overload;
    5756    procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TStream); overload; virtual; abstract;
    58     procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TByteData); overload;
    5957    procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: Pointer); overload;
    6058
    61     function AppendRawFile(LocSep: Boolean; Size: Integer; Src: TStream): Integer; overload; virtual;
    62     function AppendRawFile(LocSep: Boolean; Size: Integer; Src: TByteData): Integer; overload;
     59    function AppendRawFile(LocSep: Boolean; Src: TStream): Integer; overload; virtual;
     60    function AppendRawFile(LocSep: Boolean; Src: TByteData): Integer; overload;
    6361    function AppendRawFile(LocSep: Boolean; Size: Integer; Src: Pointer): Integer; overload;
    6462  published
     
    173171end;
    174172
    175 procedure TDataAccess.UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TByteData);
    176 var
    177   data: TStream;
    178 begin
    179   if fileid < GetFileCount then
    180   begin
    181     data := TMemoryStream.Create;
    182     data.Write(Src[0], Size);
    183     data.Seek(0, soFromBeginning);
    184     UpdateDatFilePart(FileID, offset, size, data);
    185     data.Free;
    186   end;
    187 end;
    188 
    189173procedure TDataAccess.UpdateDatFilePart(FileID, Offset, Size: Integer; Src: Pointer);
    190174var
     
    260244end;
    261245
    262 procedure TDataAccess.UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TByteData);
    263 var
    264   data: TStream;
    265 begin
    266   if fileid < GetFileCount then
    267   begin
    268     data := TMemoryStream.Create;
    269     data.Write(Src[0], Size);
     246procedure TDataAccess.UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: Pointer);
     247var
     248  data: TStream;
     249begin
     250  if fileid < GetFileCount then
     251  begin
     252    data := TMemoryStream.Create;
     253    data.Write(Src^, Size);
    270254    data.Seek(0, soFromBeginning);
    271255    UpdateRawFilePart(FileID, DatOffset, Offset, Size, data);
     
    274258end;
    275259
    276 procedure TDataAccess.UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: Pointer);
    277 var
    278   data: TStream;
    279 begin
    280   if fileid < GetFileCount then
    281   begin
    282     data := TMemoryStream.Create;
    283     data.Write(Src^, Size);
    284     data.Seek(0, soFromBeginning);
    285     UpdateRawFilePart(FileID, DatOffset, Offset, Size, data);
    286     data.Free;
    287   end;
    288 end;
    289 
    290 
    291 function TDataAccess.AppendRawFile(LocSep: Boolean; Size: Integer; Src: TStream): Integer;
     260
     261function TDataAccess.AppendRawFile(LocSep: Boolean; Src: TStream): Integer;
    292262begin
    293263  raise ENotImplemented.Create('ERROR: AppendRawFile not implemented here!!!');
     
    295265
    296266
    297 function TDataAccess.AppendRawFile(LocSep: Boolean; Size: Integer; Src: TByteData): Integer;
     267function TDataAccess.AppendRawFile(LocSep: Boolean; Src: TByteData): Integer;
    298268var
    299269  data: TStream;
    300270begin
    301271  data := TMemoryStream.Create;
    302   data.Write(Src[0], Size);
    303   AppendRawFile(LocSep, Size, data);
     272  data.Write(Src[0], Length(Src));
     273  data.Seek(0, soFromBeginning);
     274  AppendRawFile(LocSep, data);
    304275  data.Free;
    305276end;
     
    311282  data := TMemoryStream.Create;
    312283  data.Write(Src^, Size);
    313   AppendRawFile(LocSep, Size, data);
     284  data.Seek(0, soFromBeginning);
     285  AppendRawFile(LocSep, data);
    314286  data.Free;
    315287end;
Note: See TracChangeset for help on using the changeset viewer.