Changeset 248


Ignore:
Timestamp:
Nov 26, 2007, 12:02:28 PM (17 years ago)
Author:
alloc
Message:
 
Location:
oup/current
Files:
23 edited

Legend:

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

    r243 r248  
    1212    Fdat_files:          TFiles;
    1313    Fdat_extensionsmap:  TExtensionsMap;
    14     FUnloadWhenUnused:   Boolean;
    15     FDatOpened:          Boolean;
    16     FRawOpened:          Boolean;
    17     FSepOpened:          Boolean;
    18     procedure SetUnloadWhenUnused(doit: Boolean);
    1914  protected
    2015  public
    21     property UnloadWhenUnused: Boolean Read FUnloadWhenUnused Write SetUnloadWhenUnused;
    22 
    2316    constructor Create(DatFilename: String; ConnectionID: Integer; var Msg: TStatusMessages); override;
    2417    procedure Close; override;
     
    7265  Fdat_namedfilesmap: TNamedFilesMap;
    7366begin
    74   FUnloadWhenUnused := True;
    75   FDatOpened := False;
    76   FRawOpened := False;
    7767  Msg := SM_UnknownError;
    7868  if not FileExists(DatFilename) then
     
    156146  FLevelNumber := FLevelNumber div 2;
    157147
    158   Fdat_file.Free;
     148  Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
     149    fmOpenReadWrite);
     150  if not (FDataOS = DOS_WIN) then
     151    Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
     152      fmOpenReadWrite);
    159153
    160154  Msg := SM_OK;
     
    169163
    170164
    171 procedure TAccess_OniArchive.SetUnloadWhenUnused(doit: Boolean);
    172 begin
    173   FUnloadWhenUnused := doit;
    174   if FUnloadWhenUnused then
    175   begin
    176     if FDatOpened then
    177     begin
    178       FDatOpened := False;
    179       Fdat_file.Free;
    180     end;
    181     if FRawOpened then
    182     begin
    183       FRawOpened := False;
    184       Fraw_file.Free;
    185     end;
    186     if FSepOpened then
    187     begin
    188       FSepOpened := False;
    189       Fsep_file.Free;
    190     end;
    191   end
    192   else
    193   begin
    194     if not FDatOpened then
    195     begin
    196       Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);
    197       FDatOpened := True;
    198     end;
    199     if not FRawOpened then
    200     begin
    201       Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
    202         fmOpenReadWrite);
    203       FRawOpened := True;
    204     end;
    205     if (not FSepOpened) and (FDataOS <> DOS_WIN) then
    206     begin
    207       Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
    208         fmOpenReadWrite);
    209       FSepOpened := True;
    210     end;
    211   end;
    212 end;
    213 
    214 
    215 
    216 
    217 
    218165procedure TAccess_OniArchive.Close;
    219166begin
    220   if FDatOpened then
     167  if Assigned(Fdat_file) then
    221168    Fdat_file.Free;
    222   if FRawOpened then
     169  if Assigned(Fraw_file) then
    223170    Fraw_file.Free;
    224   if FSepOpened then
     171  if Assigned(Fsep_file) then
    225172    Fsep_file.Free;
    226173  Self.Free;
     
    373320  if fileid < GetFileCount then
    374321  begin
     322    if not Assigned(Target) then
     323      Target := TMemoryStream.Create;
    375324    if GetFileInfo(FileID).Size > 0 then
    376325    begin
    377       if not Assigned(Target) then
    378         Target := TMemoryStream.Create;
    379       if not FDatOpened then
    380         Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);
    381326      Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning);
    382327      streampos := Target.Position;
    383328      Target.CopyFrom(Fdat_file, Fdat_files[fileid].Size);
    384329      Target.Seek(streampos, soFromBeginning);
    385       if UnloadWhenUnused then
    386       begin
    387         Fdat_file.Free;
    388         FDatOpened := False;
    389       end
    390       else
    391         FDatOpened := True;
    392330    end;
    393331  end;
     
    398336  if fileid < GetFileCount then
    399337  begin
    400     if not FDatOpened then
    401       Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);
    402338    Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning);
    403339    Fdat_file.CopyFrom(Src, Fdat_files[fileid].Size);
    404     if UnloadWhenUnused then
    405     begin
    406       Fdat_file.Free;
    407       FDatOpened := False;
    408     end
    409     else
    410       FDatOpened := True;
    411340  end;
    412341end;
     
    420349    if not Assigned(Target) then
    421350      Target := TMemoryStream.Create;
    422     if not FDatOpened then
    423       Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);
    424351    Fdat_file.Seek(Fdat_files[fileid].DatAddr + offset, soFromBeginning);
    425352    streampos := Target.Position;
    426353    Target.CopyFrom(Fdat_file, size);
    427354    Target.Seek(streampos, soFromBeginning);
    428     if UnloadWhenUnused then
    429     begin
    430       FDatOpened := False;
    431       Fdat_file.Free;
    432     end
    433     else
    434       FDatOpened := True;
    435355  end;
    436356end;
     
    440360  if fileid < GetFileCount then
    441361  begin
    442     if not FDatOpened then
    443       Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);
    444362    Fdat_file.Seek(Fdat_files[fileid].DatAddr + offset, soFromBeginning);
    445363    Fdat_file.CopyFrom(Src, Size);
    446     if UnloadWhenUnused then
    447     begin
    448       Fdat_file.Free;
    449       FDatOpened := False;
    450     end
    451     else
    452       FDatOpened := True;
    453364  end;
    454365end;
     
    531442  if not LocSep then
    532443  begin
    533     if not FRawOpened then
    534       Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
    535         fmOpenReadWrite);
    536444    if RawAddr <= Fraw_file.Size then
    537445    begin
     
    540448      Target.Seek(0, soFromBeginning);
    541449    end;
    542     if UnloadWhenUnused then
    543     begin
    544       FRawOpened := False;
    545       Fraw_file.Free;
    546     end
    547     else
    548       FRawOpened := True;
    549450  end
    550451  else
    551452  begin
    552     if not FSepOpened then
    553       Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
    554         fmOpenReadWrite);
    555453    if RawAddr <= Fsep_file.Size then
    556454    begin
     
    559457      Target.Seek(0, soFromBeginning);
    560458    end;
    561     if UnloadWhenUnused then
    562     begin
    563       FSepOpened := False;
    564       Fsep_file.Free;
    565     end
    566     else
    567       FSepOpened := True;
    568459  end;
    569460end;
     
    591482    if not raw_info.LocSep then
    592483    begin
    593       if not FRawOpened then
    594         Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
    595           fmOpenReadWrite);
    596484      Fraw_file.Seek(raw_info.RawAddr, soFromBeginning);
    597485      streampos := Target.Position;
    598486      Target.CopyFrom(Fraw_file, raw_info.RawSize);
    599487      Target.Seek(streampos, soFromBeginning);
    600       if UnloadWhenUnused then
    601       begin
    602         FRawOpened := False;
    603         Fraw_file.Free;
    604       end
    605       else
    606         FRawOpened := True;
    607488    end
    608489    else
    609490    begin
    610       if FUnloadWhenUnused or not FSepOpened then
    611         Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
    612           fmOpenReadWrite);
    613491      Fsep_file.Seek(raw_info.RawAddr, soFromBeginning);
    614492      streampos := Target.Position;
    615493      Target.CopyFrom(Fsep_file, raw_info.RawSize);
    616494      Target.Seek(streampos, soFromBeginning);
    617       if UnloadWhenUnused then
    618       begin
    619         FSepOpened := False;
    620         Fsep_file.Free;
    621       end
    622       else
    623         FSepOpened := True;
    624495    end;
    625496  end;
     
    635506    if not raw_info.LocSep then
    636507    begin
    637       if not FRawOpened then
    638         Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
    639           fmOpenReadWrite);
    640508      Fraw_file.Seek(raw_info.RawAddr, soFromBeginning);
    641509      Fraw_file.CopyFrom(Src, Min(raw_info.RawSize, Src.Size));
    642       if UnloadWhenUnused then
    643       begin
    644         FRawOpened := False;
    645         Fraw_file.Free;
    646       end
    647       else
    648         FRawOpened := True;
    649510    end
    650511    else
    651512    begin
    652       if not FSepOpened then
    653         Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
    654           fmOpenReadWrite);
    655513      Fsep_file.Seek(raw_info.RawAddr, soFromBeginning);
    656514      Fsep_file.CopyFrom(Src, raw_info.RawSize);
    657       if UnloadWhenUnused then
    658       begin
    659         FSepOpened := False;
    660         Fsep_file.Free;
    661       end
    662       else
    663         FSepOpened := True;
    664515    end;
    665516  end;
     
    694545    if not raw_info.LocSep then
    695546    begin
    696       if not FRawOpened then
    697         Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
    698           fmOpenReadWrite);
    699547      Fraw_file.Seek(raw_info.RawAddr + Offset, soFromBeginning);
    700548      Fraw_file.CopyFrom(Src, Size);
    701       if UnloadWhenUnused then
    702       begin
    703         FRawOpened := False;
    704         Fraw_file.Free;
    705       end
    706       else
    707         FRawOpened := True;
    708549    end
    709550    else
    710551    begin
    711       if not FSepOpened then
    712         Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
    713           fmOpenReadWrite);
    714552      Fsep_file.Seek(raw_info.RawAddr + Offset, soFromBeginning);
    715553      Fsep_file.CopyFrom(Src, Size);
    716       if UnloadWhenUnused then
    717       begin
    718         FSepOpened := False;
    719         Fsep_file.Free;
    720       end
    721       else
    722         FSepOpened := True;
    723554    end;
    724555  end;
     
    732563  if not LocSep then
    733564  begin
    734     if not FRawOpened then
    735       Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
    736         fmOpenReadWrite);
    737565    if (Fraw_file.Size mod 32) > 0 then
    738566      Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32));
     
    742570    if (Fraw_file.Size mod 32) > 0 then
    743571      Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32));
    744     if UnloadWhenUnused then
    745     begin
    746       FRawOpened := False;
    747       Fraw_file.Free;
    748     end
    749     else
    750       FRawOpened := True;
    751572  end
    752573  else
    753574  begin
    754     if not FSepOpened then
    755       Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
    756         fmOpenReadWrite);
    757575    if (Fsep_file.Size mod 32) > 0 then
    758576      Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32));
     
    762580    if (Fsep_file.Size mod 32) > 0 then
    763581      Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32));
    764     if UnloadWhenUnused then
    765     begin
    766       FSepOpened := False;
    767       Fsep_file.Free;
    768     end
    769     else
    770       FSepOpened := True;
    771582  end;
    772583end;
  • oup/current/FileClasses/AKEV.pas

    r246 r248  
    77
    88type
    9   TFile_AKEV = class(TFile)
     9  TFile_AKEV = class(TResource)
    1010    public
    1111      procedure InitDataFields; override;
     
    2323  with FDataFields do
    2424  begin
    25     AddField(TFileID, 'FileID', '', []);
     25    AddField(TResourceID, 'FileID', '', []);
    2626    AddField(TLevelID, 'LevelID', '', []);
    2727
  • oup/current/FileClasses/AKVA.pas

    r241 r248  
    77
    88type
    9   TFile_AKVA = class(TFile)
     9  TFile_AKVA = class(TResource)
    1010    public
    1111      procedure InitDataFields; override;
     
    2323  with FDataFields do
    2424  begin
    25     AddField(TFileID, 'FileID', '', []);
     25    AddField(TResourceID, 'FileID', '', []);
    2626    AddField(TLevelID, 'LevelID', '', []);
    2727
  • oup/current/FileClasses/BINA.pas

    r245 r248  
    77
    88type
    9   TFile_BINA = class(TFile)
     9  TFile_BINA = class(TResource)
    1010      procedure SetOpened(Opened: Boolean); override;
    1111    private
     
    3333  with FDataFields do
    3434  begin
    35     AddField(TFileID, 'FileID', '', []);
     35    AddField(TResourceID, 'FileID', '', []);
    3636    AddField(TLevelID, 'LevelID', '', []);
    3737
  • oup/current/FileClasses/SUBT.pas

    r245 r248  
    77
    88type
    9   TFile_SUBT = class(TFile)
     9  TFile_SUBT = class(TResource)
    1010      procedure SetOpened(Opened: Boolean); override;
    1111    private
     
    3131  with FDataFields do
    3232  begin
    33     AddField(TFileID, 'FileID', '', []);
     33    AddField(TResourceID, 'FileID', '', []);
    3434    AddField(TLevelID, 'LevelID', '', []);
    3535    AddField(TUnused, 'Unused data', '', [16]);
  • oup/current/FileClasses/TXAN.pas

    r241 r248  
    77
    88type
    9   TFile_TXAN = class(TFile)
     9  TFile_TXAN = class(TResource)
    1010    public
    1111      procedure InitDataFields; override;
     
    2323  with FDataFields do
    2424  begin
    25     AddField(TFileID, 'FileID', '', []);
     25    AddField(TResourceID, 'FileID', '', []);
    2626
    2727    AddField(TLevelID, 'LevelID', '', []);
  • oup/current/FileClasses/TXMP.pas

    r241 r248  
    77
    88type
    9   TFile_TXMP = class(TFile)
     9  TFile_TXMP = class(TResource)
    1010    public
    1111      procedure InitDataFields; override;
     
    2727  with FDataFields do
    2828  begin
    29     AddField(TFileID, 'FileID', '', []);
     29    AddField(TResourceID, 'FileID', '', []);
    3030    AddField(TLevelID, 'LevelID', '', []);
    3131
  • oup/current/FileClasses/_DataTypes.pas

    r243 r248  
    121121
    122122
    123   TFileID = class(TDataField)
     123  TResourceID = class(TDataField)
    124124    protected
    125125      FFileID: Integer;
     
    257257    for i := 0 to High(ExtraArgs) do
    258258      FExtraArgs[i] := ExtraArgs[i];
    259   FConnectionID := TFile(ParentFile).ConnectionID;
     259  FConnectionID := TResource(ParentFile).ConnectionID;
    260260end;
    261261
     
    305305  i: Integer;
    306306begin
    307   fstream := TFile(FParentFile).FileStream;
     307  fstream := TResource(FParentFile).FileStream;
    308308  fstream.Seek(FOffset, soFromBeginning);
    309309  SetLength(FString, FDataLength);
     
    351351  fstream: TMemoryStream;
    352352begin
    353   fstream := TFile(FParentFile).FileStream;
     353  fstream := TResource(FParentFile).FileStream;
    354354  fstream.Seek(FOffset, soFromBeginning);
    355355  fstream.Read(FInt, FDataLength);
     
    428428  if FCounterSize > 0 then
    429429  begin
    430     fstream := TFile(FParentFile).FileStream;
     430    fstream := TResource(FParentFile).FileStream;
    431431    fstream.Seek(Offset, soFromBeginning);
    432432    FBlockCount := 0;
     
    463463  if FCounterSize > 0 then
    464464  begin
    465     fstream := TFile(FParentFile).FileStream;
     465    fstream := TResource(FParentFile).FileStream;
    466466    fstream.Seek(Offset, soFromBeginning);
    467467    fstream.Write(FBlockCount, FCounterSize);
     
    622622  fstream: TMemoryStream;
    623623begin
    624   fstream := TFile(FParentFile).FileStream;
     624  fstream := TResource(FParentFile).FileStream;
    625625  fstream.Seek(FOffset, soFromBeginning);
    626626  fstream.Read(FLevelID, 4);
     
    640640{ TFileID }
    641641
    642 constructor TFileID.Create(ParentFile: TObject; ParentBlock: TContainer;
     642constructor TResourceID.Create(ParentFile: TObject; ParentBlock: TContainer;
    643643    Name, Description: String; ExtraArgs: array of const);
    644644begin
     
    649649end;
    650650
    651 function TFileID.GetValueAsString: String;
     651function TResourceID.GetValueAsString: String;
    652652begin
    653653  Result := IntToStr(FFileID);
    654654end;
    655655
    656 procedure TFileID.Update(Offset, Length: Integer);
     656procedure TResourceID.Update(Offset, Length: Integer);
    657657var
    658658  fstream: TMemoryStream;
    659659begin
    660   fstream := TFile(FParentFile).FileStream;
     660  fstream := TResource(FParentFile).FileStream;
    661661  fstream.Seek(FOffset, soFromBeginning);
    662662  fstream.Read(FFileID, 4);
     
    667667end;
    668668
    669 procedure TFileID.WriteData(stream: TStream);
     669procedure TResourceID.WriteData(stream: TStream);
    670670var
    671671  tempi: Integer;
     
    731731  fstream: TMemoryStream;
    732732begin
    733   fstream := TFile(FParentFile).FileStream;
     733  fstream := TResource(FParentFile).FileStream;
    734734  fstream.Seek(FOffset, soFromBeginning);
    735735  fstream.Read(FFileID, 4);
     
    781781  fstream: TMemoryStream;
    782782begin
    783   fstream := TFile(FParentFile).FileStream;
     783  fstream := TResource(FParentFile).FileStream;
    784784  fstream.Seek(FOffset, soFromBeginning);
    785785  fstream.Read(FRawAddress, 4);
     
    868868  fstream: TMemoryStream;
    869869begin
    870   fstream := TFile(FParentFile).FileStream;
     870  fstream := TResource(FParentFile).FileStream;
    871871  fstream.Seek(FOffset, soFromBeginning);
    872872  fstream.Read(FBits, FDataLength);
     
    900900  fstream: TMemoryStream;
    901901begin
    902   fstream := TFile(FParentFile).FileStream;
     902  fstream := TResource(FParentFile).FileStream;
    903903  fstream.Seek(FOffset, soFromBeginning);
    904904  fstream.Read(FFloat, FDataLength);
  • oup/current/FileClasses/_EmptyFile.pas

    r238 r248  
    77
    88type
    9   TFile_Empty = class(TFile)
     9  TFile_Empty = class(TResource)
    1010  end;
    1111
  • oup/current/FileClasses/_FileTypes.pas

    r245 r248  
    1313  end;
    1414
    15   TFile = class(TTreeElement)
     15  TResource = class(TTreeElement)
    1616    protected
    1717      FFileInfo: TFileInfo;
     
    2121      FCached: Boolean;
    2222      FChanged: Boolean;
     23      FReplaced: Boolean;
    2324
    2425      FDataFields: TBlock;
     
    6768  end;
    6869
    69 
    70   TFileType = class of TFile;
     70type
     71  TFileType = class of TResource;
    7172
    7273
     
    8081{ TFileType }
    8182
    82 procedure TFile.CacheFile;
     83procedure TResource.CacheFile;
    8384begin
    8485  if not Assigned(FFileStream) then
     
    9091
    9192
    92 procedure TFile.CacheRawFile(Offset: Integer);
     93procedure TResource.CacheRawFile(Offset: Integer);
    9394var
    9495  i: Integer;
     
    107108end;
    108109
    109 procedure TFile.CacheAllRawFiles;
     110procedure TResource.CacheAllRawFiles;
    110111var
    111112  i: Integer;
     
    117118
    118119
    119 procedure TFile.DiscardFileCache;
     120procedure TResource.DiscardFileCache;
    120121begin
    121122  if Assigned(FFileStream) then
     
    124125end;
    125126
    126 procedure TFile.DiscardRawCache(Offset: Integer);
     127procedure TResource.DiscardRawCache(Offset: Integer);
    127128var
    128129  i: Integer;
     
    139140end;
    140141
    141 procedure TFile.DiscardAllRawCaches;
     142procedure TResource.DiscardAllRawCaches;
    142143var
    143144  i: Integer;
     
    147148end;
    148149
    149 procedure TFile.StoreFileCache;
     150procedure TResource.StoreFileCache;
    150151begin
    151152  Exit;
    152153end;
    153154
    154 procedure TFile.StoreRawCache(Offset: Integer);
     155procedure TResource.StoreRawCache(Offset: Integer);
    155156begin
    156157  Exit;
    157158end;
    158159
    159 procedure TFile.StoreAllRawCaches;
     160procedure TResource.StoreAllRawCaches;
    160161var
    161162  i: Integer;
     
    169170
    170171
    171 procedure TFile.SetOpened(Opened: Boolean);
     172procedure TResource.SetOpened(Opened: Boolean);
    172173begin
    173174  FOpened := Opened;
     
    175176
    176177
    177 constructor TFile.Create(ConnectionID, FileID: Integer);
     178constructor TResource.Create(ConnectionID, FileID: Integer);
    178179var
    179180  rawlist: TRawDataList;
     
    199200
    200201
    201 procedure TFile.Free;
     202procedure TResource.Free;
    202203begin
    203204  FDataFields.Free;
     
    205206
    206207
    207 function TFile.GetFieldByOffset(Offset: Integer): TDataField;
     208function TResource.GetFieldByOffset(Offset: Integer): TDataField;
    208209begin
    209210  Result := FDataFields.FieldByOffset[Offset];
     
    211212
    212213
    213 function TFile.GetRawCacheID(Offset: Integer): Integer;
     214function TResource.GetRawCacheID(Offset: Integer): Integer;
    214215var
    215216  i: Integer;
     
    221222end;
    222223
    223 function TFile.GetType: String;
     224function TResource.GetType: String;
    224225begin
    225226  Result := FFileInfo.Extension;
    226227end;
    227228
    228 function TFile.GetCaption: String;
     229function TResource.GetCaption: String;
    229230begin
    230231  Result := FFileInfo.Name;
     
    234235end;
    235236
    236 function TFile.GetChild(ID: Integer): TTreeElement;
     237function TResource.GetChild(ID: Integer): TTreeElement;
    237238begin
    238239  Result := FDataFields.Child[ID];
    239240end;
    240241
    241 function TFile.GetChildCount: Integer;
     242function TResource.GetChildCount: Integer;
    242243begin
    243244  if FDataFields <> nil then
     
    248249
    249250
    250 function TFile.GetEditor: TFrame;
     251function TResource.GetEditor: TFrame;
    251252begin
    252253  if not Assigned(FEditor) then
     
    256257
    257258
    258 procedure TFile.InitDataFields;
     259procedure TResource.InitDataFields;
    259260begin
    260261  if Assigned(FDataFields) then
     
    265266
    266267
    267 procedure TFile.InitEditor;
     268procedure TResource.InitEditor;
    268269begin
    269270  Exit;
     
    274275//*********************************************************
    275276//*********************************************************
    276 procedure TFile.ReCreateFile(fs: TStream);
     277procedure TResource.ReCreateFile(fs: TStream);
    277278const
    278279  temp0: array[0..31] of Byte =
  • oup/current/FileClasses/_MetaManager.pas

    r233 r248  
    77  TMetaManager = class
    88    protected
    9       FFiles: array of TFile;
     9      FFiles: array of TResource;
    1010      FRoot: TExtensions;
    1111      FConnectionID: Integer;
    1212      FDataAccess: TObject;
    1313      function GetFileCount: Integer;
    14       function GetFileById(Id: Integer): TFile;
     14      function GetFileById(Id: Integer): TResource;
    1515    private
    1616    public
     
    2121      property Root: TExtensions read FRoot;
    2222      property FileCount: Integer read GetFileCount;
    23       property FileById[Id: Integer]: TFile read GetFileById;
     23      property FileById[Id: Integer]: TResource read GetFileById;
    2424  end;
    2525
     
    4141
    4242
    43 function TMetaManager.GetFileById(Id: Integer): TFile;
     43function TMetaManager.GetFileById(Id: Integer): TResource;
    4444begin
    4545  InitFile(Id);
     
    6464      if finfo.Size > 0 then
    6565      begin
    66         for typei := 0 to High(FileDescs) do
     66        for typei := 0 to High(ResourceDescs) do
    6767        begin
    68           if FileDescs[typei].ext = finfo.Extension then
     68          if ResourceDescs[typei].ext = finfo.Extension then
    6969          begin
    70             FFiles[id] := TFileClass(FileDescs[typei].ftype).Create(FConnectionID, id);
     70            FFiles[id] := TResourceClass(ResourceDescs[typei].ftype).Create(FConnectionID, id);
    7171            Break;
    7272          end;
    7373        end;
    74         if typei > High(FileDescs) then
     74        if typei > High(ResourceDescs) then
    7575          FFiles[id] := TFile_Empty.Create(FConnectionID, id);
    7676      end else
  • oup/current/FileClasses/_MetaTypes.pas

    r245 r248  
    1818type
    1919  TTreeElement = _TreeElement.TTreeElement;
    20   TFile = _FileTypes.TFile;
     20  TResource = _FileTypes.TResource;
    2121  TFile_Empty = _EmptyFile.TFile_Empty;
    2222  TExtension = _Extensions.TExtension;
     
    2828  TArray = _DataTypes.TArray;
    2929
    30   TFileID = _DataTypes.TFileID;
     30  TResourceID = _DataTypes.TResourceID;
    3131  TLevelID = _DataTypes.TLevelID;
    3232  TInt = _DataTypes.TInt;
     
    3939  TUnused = _DataTypes.TUnused;
    4040
    41   TFileClass = class of TFile;
    42   TFileDesc = record
     41  TResourceClass = class of TResource;
     42  TResourceDesc = record
    4343    ext: String;
    44     ftype: TFileClass;
     44    ftype: TResourceClass;
    4545  end;
    4646
    4747const
    48   FileDescs: array[0..5] of TFileDesc = (
     48  ResourceDescs: array[0..5] of TResourceDesc = (
    4949    (ext: 'AKEV'; ftype: TFile_AKEV),
    5050    (ext: 'AKVA'; ftype: TFile_AKVA),
  • oup/current/Helper/LevelDB.pas

    r241 r248  
    639639  Application.ProcessMessages;
    640640
    641   TAccess_OniArchive(Connection).UnloadWhenUnused := False;
    642 
    643641  FileTime := Time;
    644642  Database.StartTransaction;
     
    743741
    744742  converting := False;
    745   TAccess_OniArchive(Connection).UnloadWhenUnused := True;
    746743
    747744  Query.Close;
  • oup/current/Main.pas

    r247 r248  
    509509      entry.OnClick := menu_conns_itemClick;
    510510      menu_conns.Add(entry);
    511       entry := nil;
    512511    end;
    513512  end;
     
    522521  opend.Filter     := 'Compatible level files|*.dat;*.oni;*.oldb|Oni level (*.dat)|*.dat|OniSplit Archive (*.oni)|*.oni|OUP level database (*.oldb)|*.oldb|Any (*.*)|*';
    523522  if typedb then
    524     opend.FilterIndex := 3
     523    opend.FilterIndex := 4
    525524  else
    526525    opend.FilterIndex := 2;
  • oup/current/Settings.dfm

    r112 r248  
    44  BorderStyle = bsToolWindow
    55  Caption = 'Settings'
    6   ClientHeight = 197
     6  ClientHeight = 216
    77  ClientWidth = 321
    88  Color = clBtnFace
     
    1616  OnCloseQuery = FormCloseQuery
    1717  OnShow = FormShow
     18  DesignSize = (
     19    321
     20    216)
    1821  PixelsPerInch = 96
    1922  TextHeight = 13
     
    2932  object btn_ok: TButton
    3033    Left = 8
    31     Top = 168
     34    Top = 187
    3235    Width = 57
    3336    Height = 23
     37    Anchors = [akLeft, akBottom]
    3438    Caption = 'OK'
    3539    Default = True
    3640    TabOrder = 0
    3741    OnClick = btn_okClick
     42    ExplicitTop = 168
    3843  end
    3944  object btn_cancel: TButton
    4045    Left = 112
    41     Top = 168
     46    Top = 187
    4247    Width = 57
    4348    Height = 23
     49    Anchors = [akLeft, akBottom]
    4450    Cancel = True
    4551    Caption = 'Cancel'
    4652    TabOrder = 1
    4753    OnClick = btn_cancelClick
     54    ExplicitTop = 168
    4855  end
    4956  object combo_charset: TComboBox
     
    8693  object check_reg_oldb: TCheckBox
    8794    Left = 8
    88     Top = 110
     95    Top = 133
    8996    Width = 180
    9097    Height = 17
     
    94101  object check_reg_opf: TCheckBox
    95102    Left = 8
    96     Top = 133
     103    Top = 156
    97104    Width = 180
    98105    Height = 17
     
    100107    TabOrder = 6
    101108  end
     109  object check_reg_oni: TCheckBox
     110    Left = 8
     111    Top = 110
     112    Width = 180
     113    Height = 17
     114    Caption = 'Register .oni files with OUP'
     115    TabOrder = 7
     116  end
    102117end
  • oup/current/Settings.pas

    r204 r248  
    1515    check_reg_oldb: TCheckBox;
    1616    check_reg_opf: TCheckBox;
     17    check_reg_oni: TCheckBox;
    1718    procedure btn_cancelClick(Sender: TObject);
    1819    procedure btn_okClick(Sender: TObject);
     
    118119    RegisterExtension('.dat', 2, False);
    119120
     121  if check_reg_oni.Checked then
     122  begin
     123    if ExtensionRegistered('.oni', temps) then
     124    begin
     125      if temps <> 'ONI.oni' then
     126        if MessageBox(Self.Handle, PChar('.oni-files already registered to "' +
     127              temps+'". Reregister?'), PChar('Reregister?'),
     128              MB_YESNO + MB_ICONQUESTION) = ID_YES then
     129          RegisterExtension('.oni', 2, True);
     130    end else
     131      RegisterExtension('.oni', 2, True);
     132  end else
     133    RegisterExtension('.oni', 2, False);
     134
    120135  if check_reg_oldb.Checked then
    121136  begin
     
    168183  if ExtensionRegistered('.dat', temps) then
    169184    check_reg_dat.Checked := temps = 'ONI.dat'
     185  else
     186    check_reg_dat.Checked := False;
     187
     188  if ExtensionRegistered('.oni', temps) then
     189    check_reg_dat.Checked := temps = 'ONI.oni'
    170190  else
    171191    check_reg_dat.Checked := False;
  • oup/current/Tools/BinEdit.dfm

    r245 r248  
    107107        Colors.EvenColumn = clNavy
    108108        Colors.CurrentOffsetBackground = clBtnShadow
    109         Colors.OffsetBackGround = clBtnFace
     109        Colors.OffsetBackground = clBtnFace
    110110        Colors.CurrentOffset = clBtnHighlight
    111111        Colors.Grid = clBtnFace
     
    116116        AllowInsertMode = False
    117117        DrawGridLines = False
    118         Version = 'May 23, 2005; '#169' markus stephany, vcl[at]mirkes[dot]de'
     118        Version = 'september 30, 2007; '#169' markus stephany, vcl[at]mirkes[dot]de'
    119119        OnChange = hexChange
    120120        ShowPositionIfNotFocused = True
  • oup/current/Tools/BinEdit.pas

    r231 r248  
    141141//      Self.SelectFileID(ConnectionID, fileid);
    142142    Self.ClearStructViewer;
     143    ClearValues;
    143144    mem := nil;
    144     ConManager.Connection[ConID].LoadDatFile(fileid, TStream(mem));
    145     rawlist := ConManager.Connection[ConID].GetRawList(fileid);
    146     hex.LoadFromStream(mem);
    147     mem.Free;
    148     ClearValues;
    149     WriteStructureInfos;
     145    hex.DataSize := 0;
     146    if fileinfo.Size > 0 then
     147    begin
     148      ConManager.Connection[ConID].LoadDatFile(fileid, TStream(mem));
     149      rawlist := ConManager.Connection[ConID].GetRawList(fileid);
     150      hex.LoadFromStream(mem);
     151      mem.Free;
     152      WriteStructureInfos;
     153    end;
    150154  end
    151155  else
  • oup/current/Tools/MetaEditor.dfm

    r244 r248  
    8282        Caption = 'Meta Edit'
    8383        ImageIndex = 1
     84        ExplicitLeft = 0
     85        ExplicitTop = 0
     86        ExplicitWidth = 0
     87        ExplicitHeight = 0
    8488      end
    8589      object tab_hex: TTabSheet
    8690        Caption = 'Binary Edit'
     91        ExplicitLeft = 0
     92        ExplicitTop = 0
     93        ExplicitWidth = 0
     94        ExplicitHeight = 0
    8795        object splitter_hex_1: TSplitter
    8896          Left = 0
     
    162170          Colors.EvenColumn = clNavy
    163171          Colors.CurrentOffsetBackground = clBtnShadow
    164           Colors.OffsetBackGround = clBtnFace
     172          Colors.OffsetBackground = clBtnFace
    165173          Colors.CurrentOffset = clBtnHighlight
    166174          Colors.Grid = clBtnFace
     
    171179          AllowInsertMode = False
    172180          DrawGridLines = False
    173           Version = 'May 23, 2005; '#169' markus stephany, vcl[at]mirkes[dot]de'
     181          Version = 'september 30, 2007; '#169' markus stephany, vcl[at]mirkes[dot]de'
    174182          ShowPositionIfNotFocused = True
    175183        end
  • oup/current/Tools/MetaEditor.pas

    r244 r248  
    149149var
    150150  data: PNodeData;
    151   ffile: TFile;
     151  ffile: TResource;
    152152//*******************************************************************
    153153  fs: TFileStream;
     
    156156  data := Sender.GetNodeData(Node);
    157157  ffile := nil;
    158   if data.Field is TFile then
    159     ffile := TFile(data.Field);
     158  if data.Field is TResource then
     159    ffile := TResource(data.Field);
    160160  if data.Field is _MetaTypes.TDatLink then
    161161    if Assigned(_MetaTypes.TDatLink(data.Field).TargetFile) then
    162       ffile := TFile(_MetaTypes.TDatLink(data.Field).TargetFile);
     162      ffile := TResource(_MetaTypes.TDatLink(data.Field).TargetFile);
    163163  if Assigned(ffile) then
    164164  begin
     
    186186begin
    187187  data := Sender.GetNodeData(NewNode);
    188   if data.Field is TFile then
    189   begin
    190     if Assigned(TFile(data.Field).Editor) then
    191       Allowed := not TFile(data.Field).Opened
     188  if data.Field is TResource then
     189  begin
     190    if Assigned(TResource(data.Field).Editor) then
     191      Allowed := not TResource(data.Field).Opened
    192192    else
    193193      Allowed := True;
     
    196196  begin
    197197    data := Sender.GetNodeData(OldNode);
    198     if data.Field is TFile then
    199     begin
    200       if TFile(data.Field).Opened then
     198    if data.Field is TResource then
     199    begin
     200      if TResource(data.Field).Opened then
    201201      begin
    202202        if tab_meta.ControlCount > 0 then
    203203          for i := 0 to tab_meta.ControlCount - 1 do
    204204            tab_meta.RemoveControl(tab_meta.Controls[i]);
    205         TFile(data.Field).Opened := False;
     205        TResource(data.Field).Opened := False;
    206206      end;
    207207    end;
     
    244244      0:
    245245        begin
    246           if Data.Field is TFile then
     246          if Data.Field is TResource then
    247247          begin
    248             if Length(TFile(Data.Field).FileInfo.Name) = 0 then
     248            if Length(TResource(Data.Field).FileInfo.Name) = 0 then
    249249              TargetCanvas.Font.Color := $C06060;
    250             if TFile(Data.Field).FileInfo.Size = 0 then
     250            if TResource(Data.Field).FileInfo.Size = 0 then
    251251              TargetCanvas.Font.Color := $2020A0;
    252252          end;
     
    267267  i: Integer;
    268268  links: TStrings;
    269   ifile: TFile;
     269  ifile: TResource;
    270270begin
    271271  inherited;
     
    283283        end;
    284284      end;
    285       if data.Field is TFile then
     285      if data.Field is TResource then
    286286      begin
    287         ifile := TFile(data.Field);
     287        ifile := TResource(data.Field);
    288288        case Column of
    289289          0: HintText :=
  • oup/current/Tools/_TemplateFileList.dfm

    r241 r248  
    3838        object tab_files: TTabSheet
    3939          Caption = 'Filelist'
     40          ExplicitLeft = 0
     41          ExplicitTop = 0
     42          ExplicitWidth = 0
     43          ExplicitHeight = 0
    4044          object panel_extension: TPanel
    4145            Left = 0
     
    220224              Font.Name = 'Courier'
    221225              Font.Style = []
    222               ItemHeight = 13
     226              ItemHeight = 0
    223227              ParentFont = False
    224228              Sorted = True
     
    270274          Caption = 'Tree'
    271275          ImageIndex = 1
     276          ExplicitLeft = 0
     277          ExplicitTop = 0
     278          ExplicitWidth = 0
     279          ExplicitHeight = 0
    272280          object filelist_meta: TVirtualStringTree
    273281            Left = 0
  • oup/current/Tools/_TemplateFileList.pas

    r233 r248  
    420420  inherited;
    421421  data := Sender.GetNodeData(Node);
    422   if data.Field is TFile then
     422  if data.Field is TResource then
    423423  begin
    424424    if Assigned(FOnNewFileSelected) then
    425425    begin
    426       FOnNewFileSelected(TFile(data.Field).FileInfo);
     426      FOnNewFileSelected(TResource(data.Field).FileInfo);
    427427    end;
    428428  end;
     
    437437  inherited;
    438438  data := Sender.GetNodeData(NewNode);
    439   if data.Field is TFile then
     439  if data.Field is TResource then
    440440  begin
    441441    if Assigned(FOnNewFileSelecting) then
    442442    begin
    443       FOnNewFileSelecting(TFile(data.Field).FileInfo, Allowed);
     443      FOnNewFileSelecting(TResource(data.Field).FileInfo, Allowed);
    444444    end;
    445445  end;
     
    519519begin
    520520  Data     := Sender.GetNodeData(Node);
    521   if Data.Field is TFile then
    522   begin
    523     if Length(TFile(Data.Field).FileInfo.Name) = 0 then
     521  if Data.Field is TResource then
     522  begin
     523    if Length(TResource(Data.Field).FileInfo.Name) = 0 then
    524524      TargetCanvas.Font.Color := $C06060;
    525     if TFile(Data.Field).FileInfo.Size = 0 then
     525    if TResource(Data.Field).FileInfo.Size = 0 then
    526526      TargetCanvas.Font.Color := $2020A0;
    527527  end;
Note: See TracChangeset for help on using the changeset viewer.