Changeset 248
- Timestamp:
- Nov 26, 2007, 12:02:28 PM (17 years ago)
- Location:
- oup/current
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/DataAccess/Access_OniArchive.pas
r243 r248 12 12 Fdat_files: TFiles; 13 13 Fdat_extensionsmap: TExtensionsMap; 14 FUnloadWhenUnused: Boolean;15 FDatOpened: Boolean;16 FRawOpened: Boolean;17 FSepOpened: Boolean;18 procedure SetUnloadWhenUnused(doit: Boolean);19 14 protected 20 15 public 21 property UnloadWhenUnused: Boolean Read FUnloadWhenUnused Write SetUnloadWhenUnused;22 23 16 constructor Create(DatFilename: String; ConnectionID: Integer; var Msg: TStatusMessages); override; 24 17 procedure Close; override; … … 72 65 Fdat_namedfilesmap: TNamedFilesMap; 73 66 begin 74 FUnloadWhenUnused := True;75 FDatOpened := False;76 FRawOpened := False;77 67 Msg := SM_UnknownError; 78 68 if not FileExists(DatFilename) then … … 156 146 FLevelNumber := FLevelNumber div 2; 157 147 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); 159 153 160 154 Msg := SM_OK; … … 169 163 170 164 171 procedure TAccess_OniArchive.SetUnloadWhenUnused(doit: Boolean);172 begin173 FUnloadWhenUnused := doit;174 if FUnloadWhenUnused then175 begin176 if FDatOpened then177 begin178 FDatOpened := False;179 Fdat_file.Free;180 end;181 if FRawOpened then182 begin183 FRawOpened := False;184 Fraw_file.Free;185 end;186 if FSepOpened then187 begin188 FSepOpened := False;189 Fsep_file.Free;190 end;191 end192 else193 begin194 if not FDatOpened then195 begin196 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);197 FDatOpened := True;198 end;199 if not FRawOpened then200 begin201 Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),202 fmOpenReadWrite);203 FRawOpened := True;204 end;205 if (not FSepOpened) and (FDataOS <> DOS_WIN) then206 begin207 Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),208 fmOpenReadWrite);209 FSepOpened := True;210 end;211 end;212 end;213 214 215 216 217 218 165 procedure TAccess_OniArchive.Close; 219 166 begin 220 if FDatOpenedthen167 if Assigned(Fdat_file) then 221 168 Fdat_file.Free; 222 if FRawOpenedthen169 if Assigned(Fraw_file) then 223 170 Fraw_file.Free; 224 if FSepOpenedthen171 if Assigned(Fsep_file) then 225 172 Fsep_file.Free; 226 173 Self.Free; … … 373 320 if fileid < GetFileCount then 374 321 begin 322 if not Assigned(Target) then 323 Target := TMemoryStream.Create; 375 324 if GetFileInfo(FileID).Size > 0 then 376 325 begin 377 if not Assigned(Target) then378 Target := TMemoryStream.Create;379 if not FDatOpened then380 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);381 326 Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning); 382 327 streampos := Target.Position; 383 328 Target.CopyFrom(Fdat_file, Fdat_files[fileid].Size); 384 329 Target.Seek(streampos, soFromBeginning); 385 if UnloadWhenUnused then386 begin387 Fdat_file.Free;388 FDatOpened := False;389 end390 else391 FDatOpened := True;392 330 end; 393 331 end; … … 398 336 if fileid < GetFileCount then 399 337 begin 400 if not FDatOpened then401 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);402 338 Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning); 403 339 Fdat_file.CopyFrom(Src, Fdat_files[fileid].Size); 404 if UnloadWhenUnused then405 begin406 Fdat_file.Free;407 FDatOpened := False;408 end409 else410 FDatOpened := True;411 340 end; 412 341 end; … … 420 349 if not Assigned(Target) then 421 350 Target := TMemoryStream.Create; 422 if not FDatOpened then423 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);424 351 Fdat_file.Seek(Fdat_files[fileid].DatAddr + offset, soFromBeginning); 425 352 streampos := Target.Position; 426 353 Target.CopyFrom(Fdat_file, size); 427 354 Target.Seek(streampos, soFromBeginning); 428 if UnloadWhenUnused then429 begin430 FDatOpened := False;431 Fdat_file.Free;432 end433 else434 FDatOpened := True;435 355 end; 436 356 end; … … 440 360 if fileid < GetFileCount then 441 361 begin 442 if not FDatOpened then443 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite);444 362 Fdat_file.Seek(Fdat_files[fileid].DatAddr + offset, soFromBeginning); 445 363 Fdat_file.CopyFrom(Src, Size); 446 if UnloadWhenUnused then447 begin448 Fdat_file.Free;449 FDatOpened := False;450 end451 else452 FDatOpened := True;453 364 end; 454 365 end; … … 531 442 if not LocSep then 532 443 begin 533 if not FRawOpened then534 Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),535 fmOpenReadWrite);536 444 if RawAddr <= Fraw_file.Size then 537 445 begin … … 540 448 Target.Seek(0, soFromBeginning); 541 449 end; 542 if UnloadWhenUnused then543 begin544 FRawOpened := False;545 Fraw_file.Free;546 end547 else548 FRawOpened := True;549 450 end 550 451 else 551 452 begin 552 if not FSepOpened then553 Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),554 fmOpenReadWrite);555 453 if RawAddr <= Fsep_file.Size then 556 454 begin … … 559 457 Target.Seek(0, soFromBeginning); 560 458 end; 561 if UnloadWhenUnused then562 begin563 FSepOpened := False;564 Fsep_file.Free;565 end566 else567 FSepOpened := True;568 459 end; 569 460 end; … … 591 482 if not raw_info.LocSep then 592 483 begin 593 if not FRawOpened then594 Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),595 fmOpenReadWrite);596 484 Fraw_file.Seek(raw_info.RawAddr, soFromBeginning); 597 485 streampos := Target.Position; 598 486 Target.CopyFrom(Fraw_file, raw_info.RawSize); 599 487 Target.Seek(streampos, soFromBeginning); 600 if UnloadWhenUnused then601 begin602 FRawOpened := False;603 Fraw_file.Free;604 end605 else606 FRawOpened := True;607 488 end 608 489 else 609 490 begin 610 if FUnloadWhenUnused or not FSepOpened then611 Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),612 fmOpenReadWrite);613 491 Fsep_file.Seek(raw_info.RawAddr, soFromBeginning); 614 492 streampos := Target.Position; 615 493 Target.CopyFrom(Fsep_file, raw_info.RawSize); 616 494 Target.Seek(streampos, soFromBeginning); 617 if UnloadWhenUnused then618 begin619 FSepOpened := False;620 Fsep_file.Free;621 end622 else623 FSepOpened := True;624 495 end; 625 496 end; … … 635 506 if not raw_info.LocSep then 636 507 begin 637 if not FRawOpened then638 Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),639 fmOpenReadWrite);640 508 Fraw_file.Seek(raw_info.RawAddr, soFromBeginning); 641 509 Fraw_file.CopyFrom(Src, Min(raw_info.RawSize, Src.Size)); 642 if UnloadWhenUnused then643 begin644 FRawOpened := False;645 Fraw_file.Free;646 end647 else648 FRawOpened := True;649 510 end 650 511 else 651 512 begin 652 if not FSepOpened then653 Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),654 fmOpenReadWrite);655 513 Fsep_file.Seek(raw_info.RawAddr, soFromBeginning); 656 514 Fsep_file.CopyFrom(Src, raw_info.RawSize); 657 if UnloadWhenUnused then658 begin659 FSepOpened := False;660 Fsep_file.Free;661 end662 else663 FSepOpened := True;664 515 end; 665 516 end; … … 694 545 if not raw_info.LocSep then 695 546 begin 696 if not FRawOpened then697 Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),698 fmOpenReadWrite);699 547 Fraw_file.Seek(raw_info.RawAddr + Offset, soFromBeginning); 700 548 Fraw_file.CopyFrom(Src, Size); 701 if UnloadWhenUnused then702 begin703 FRawOpened := False;704 Fraw_file.Free;705 end706 else707 FRawOpened := True;708 549 end 709 550 else 710 551 begin 711 if not FSepOpened then712 Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),713 fmOpenReadWrite);714 552 Fsep_file.Seek(raw_info.RawAddr + Offset, soFromBeginning); 715 553 Fsep_file.CopyFrom(Src, Size); 716 if UnloadWhenUnused then717 begin718 FSepOpened := False;719 Fsep_file.Free;720 end721 else722 FSepOpened := True;723 554 end; 724 555 end; … … 732 563 if not LocSep then 733 564 begin 734 if not FRawOpened then735 Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),736 fmOpenReadWrite);737 565 if (Fraw_file.Size mod 32) > 0 then 738 566 Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32)); … … 742 570 if (Fraw_file.Size mod 32) > 0 then 743 571 Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32)); 744 if UnloadWhenUnused then745 begin746 FRawOpened := False;747 Fraw_file.Free;748 end749 else750 FRawOpened := True;751 572 end 752 573 else 753 574 begin 754 if not FSepOpened then755 Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),756 fmOpenReadWrite);757 575 if (Fsep_file.Size mod 32) > 0 then 758 576 Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32)); … … 762 580 if (Fsep_file.Size mod 32) > 0 then 763 581 Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32)); 764 if UnloadWhenUnused then765 begin766 FSepOpened := False;767 Fsep_file.Free;768 end769 else770 FSepOpened := True;771 582 end; 772 583 end; -
oup/current/FileClasses/AKEV.pas
r246 r248 7 7 8 8 type 9 TFile_AKEV = class(T File)9 TFile_AKEV = class(TResource) 10 10 public 11 11 procedure InitDataFields; override; … … 23 23 with FDataFields do 24 24 begin 25 AddField(T FileID, 'FileID', '', []);25 AddField(TResourceID, 'FileID', '', []); 26 26 AddField(TLevelID, 'LevelID', '', []); 27 27 -
oup/current/FileClasses/AKVA.pas
r241 r248 7 7 8 8 type 9 TFile_AKVA = class(T File)9 TFile_AKVA = class(TResource) 10 10 public 11 11 procedure InitDataFields; override; … … 23 23 with FDataFields do 24 24 begin 25 AddField(T FileID, 'FileID', '', []);25 AddField(TResourceID, 'FileID', '', []); 26 26 AddField(TLevelID, 'LevelID', '', []); 27 27 -
oup/current/FileClasses/BINA.pas
r245 r248 7 7 8 8 type 9 TFile_BINA = class(T File)9 TFile_BINA = class(TResource) 10 10 procedure SetOpened(Opened: Boolean); override; 11 11 private … … 33 33 with FDataFields do 34 34 begin 35 AddField(T FileID, 'FileID', '', []);35 AddField(TResourceID, 'FileID', '', []); 36 36 AddField(TLevelID, 'LevelID', '', []); 37 37 -
oup/current/FileClasses/SUBT.pas
r245 r248 7 7 8 8 type 9 TFile_SUBT = class(T File)9 TFile_SUBT = class(TResource) 10 10 procedure SetOpened(Opened: Boolean); override; 11 11 private … … 31 31 with FDataFields do 32 32 begin 33 AddField(T FileID, 'FileID', '', []);33 AddField(TResourceID, 'FileID', '', []); 34 34 AddField(TLevelID, 'LevelID', '', []); 35 35 AddField(TUnused, 'Unused data', '', [16]); -
oup/current/FileClasses/TXAN.pas
r241 r248 7 7 8 8 type 9 TFile_TXAN = class(T File)9 TFile_TXAN = class(TResource) 10 10 public 11 11 procedure InitDataFields; override; … … 23 23 with FDataFields do 24 24 begin 25 AddField(T FileID, 'FileID', '', []);25 AddField(TResourceID, 'FileID', '', []); 26 26 27 27 AddField(TLevelID, 'LevelID', '', []); -
oup/current/FileClasses/TXMP.pas
r241 r248 7 7 8 8 type 9 TFile_TXMP = class(T File)9 TFile_TXMP = class(TResource) 10 10 public 11 11 procedure InitDataFields; override; … … 27 27 with FDataFields do 28 28 begin 29 AddField(T FileID, 'FileID', '', []);29 AddField(TResourceID, 'FileID', '', []); 30 30 AddField(TLevelID, 'LevelID', '', []); 31 31 -
oup/current/FileClasses/_DataTypes.pas
r243 r248 121 121 122 122 123 T FileID = class(TDataField)123 TResourceID = class(TDataField) 124 124 protected 125 125 FFileID: Integer; … … 257 257 for i := 0 to High(ExtraArgs) do 258 258 FExtraArgs[i] := ExtraArgs[i]; 259 FConnectionID := T File(ParentFile).ConnectionID;259 FConnectionID := TResource(ParentFile).ConnectionID; 260 260 end; 261 261 … … 305 305 i: Integer; 306 306 begin 307 fstream := T File(FParentFile).FileStream;307 fstream := TResource(FParentFile).FileStream; 308 308 fstream.Seek(FOffset, soFromBeginning); 309 309 SetLength(FString, FDataLength); … … 351 351 fstream: TMemoryStream; 352 352 begin 353 fstream := T File(FParentFile).FileStream;353 fstream := TResource(FParentFile).FileStream; 354 354 fstream.Seek(FOffset, soFromBeginning); 355 355 fstream.Read(FInt, FDataLength); … … 428 428 if FCounterSize > 0 then 429 429 begin 430 fstream := T File(FParentFile).FileStream;430 fstream := TResource(FParentFile).FileStream; 431 431 fstream.Seek(Offset, soFromBeginning); 432 432 FBlockCount := 0; … … 463 463 if FCounterSize > 0 then 464 464 begin 465 fstream := T File(FParentFile).FileStream;465 fstream := TResource(FParentFile).FileStream; 466 466 fstream.Seek(Offset, soFromBeginning); 467 467 fstream.Write(FBlockCount, FCounterSize); … … 622 622 fstream: TMemoryStream; 623 623 begin 624 fstream := T File(FParentFile).FileStream;624 fstream := TResource(FParentFile).FileStream; 625 625 fstream.Seek(FOffset, soFromBeginning); 626 626 fstream.Read(FLevelID, 4); … … 640 640 { TFileID } 641 641 642 constructor T FileID.Create(ParentFile: TObject; ParentBlock: TContainer;642 constructor TResourceID.Create(ParentFile: TObject; ParentBlock: TContainer; 643 643 Name, Description: String; ExtraArgs: array of const); 644 644 begin … … 649 649 end; 650 650 651 function T FileID.GetValueAsString: String;651 function TResourceID.GetValueAsString: String; 652 652 begin 653 653 Result := IntToStr(FFileID); 654 654 end; 655 655 656 procedure T FileID.Update(Offset, Length: Integer);656 procedure TResourceID.Update(Offset, Length: Integer); 657 657 var 658 658 fstream: TMemoryStream; 659 659 begin 660 fstream := T File(FParentFile).FileStream;660 fstream := TResource(FParentFile).FileStream; 661 661 fstream.Seek(FOffset, soFromBeginning); 662 662 fstream.Read(FFileID, 4); … … 667 667 end; 668 668 669 procedure T FileID.WriteData(stream: TStream);669 procedure TResourceID.WriteData(stream: TStream); 670 670 var 671 671 tempi: Integer; … … 731 731 fstream: TMemoryStream; 732 732 begin 733 fstream := T File(FParentFile).FileStream;733 fstream := TResource(FParentFile).FileStream; 734 734 fstream.Seek(FOffset, soFromBeginning); 735 735 fstream.Read(FFileID, 4); … … 781 781 fstream: TMemoryStream; 782 782 begin 783 fstream := T File(FParentFile).FileStream;783 fstream := TResource(FParentFile).FileStream; 784 784 fstream.Seek(FOffset, soFromBeginning); 785 785 fstream.Read(FRawAddress, 4); … … 868 868 fstream: TMemoryStream; 869 869 begin 870 fstream := T File(FParentFile).FileStream;870 fstream := TResource(FParentFile).FileStream; 871 871 fstream.Seek(FOffset, soFromBeginning); 872 872 fstream.Read(FBits, FDataLength); … … 900 900 fstream: TMemoryStream; 901 901 begin 902 fstream := T File(FParentFile).FileStream;902 fstream := TResource(FParentFile).FileStream; 903 903 fstream.Seek(FOffset, soFromBeginning); 904 904 fstream.Read(FFloat, FDataLength); -
oup/current/FileClasses/_EmptyFile.pas
r238 r248 7 7 8 8 type 9 TFile_Empty = class(T File)9 TFile_Empty = class(TResource) 10 10 end; 11 11 -
oup/current/FileClasses/_FileTypes.pas
r245 r248 13 13 end; 14 14 15 T File = class(TTreeElement)15 TResource = class(TTreeElement) 16 16 protected 17 17 FFileInfo: TFileInfo; … … 21 21 FCached: Boolean; 22 22 FChanged: Boolean; 23 FReplaced: Boolean; 23 24 24 25 FDataFields: TBlock; … … 67 68 end; 68 69 69 70 TFileType = class of T File;70 type 71 TFileType = class of TResource; 71 72 72 73 … … 80 81 { TFileType } 81 82 82 procedure T File.CacheFile;83 procedure TResource.CacheFile; 83 84 begin 84 85 if not Assigned(FFileStream) then … … 90 91 91 92 92 procedure T File.CacheRawFile(Offset: Integer);93 procedure TResource.CacheRawFile(Offset: Integer); 93 94 var 94 95 i: Integer; … … 107 108 end; 108 109 109 procedure T File.CacheAllRawFiles;110 procedure TResource.CacheAllRawFiles; 110 111 var 111 112 i: Integer; … … 117 118 118 119 119 procedure T File.DiscardFileCache;120 procedure TResource.DiscardFileCache; 120 121 begin 121 122 if Assigned(FFileStream) then … … 124 125 end; 125 126 126 procedure T File.DiscardRawCache(Offset: Integer);127 procedure TResource.DiscardRawCache(Offset: Integer); 127 128 var 128 129 i: Integer; … … 139 140 end; 140 141 141 procedure T File.DiscardAllRawCaches;142 procedure TResource.DiscardAllRawCaches; 142 143 var 143 144 i: Integer; … … 147 148 end; 148 149 149 procedure T File.StoreFileCache;150 procedure TResource.StoreFileCache; 150 151 begin 151 152 Exit; 152 153 end; 153 154 154 procedure T File.StoreRawCache(Offset: Integer);155 procedure TResource.StoreRawCache(Offset: Integer); 155 156 begin 156 157 Exit; 157 158 end; 158 159 159 procedure T File.StoreAllRawCaches;160 procedure TResource.StoreAllRawCaches; 160 161 var 161 162 i: Integer; … … 169 170 170 171 171 procedure T File.SetOpened(Opened: Boolean);172 procedure TResource.SetOpened(Opened: Boolean); 172 173 begin 173 174 FOpened := Opened; … … 175 176 176 177 177 constructor T File.Create(ConnectionID, FileID: Integer);178 constructor TResource.Create(ConnectionID, FileID: Integer); 178 179 var 179 180 rawlist: TRawDataList; … … 199 200 200 201 201 procedure T File.Free;202 procedure TResource.Free; 202 203 begin 203 204 FDataFields.Free; … … 205 206 206 207 207 function T File.GetFieldByOffset(Offset: Integer): TDataField;208 function TResource.GetFieldByOffset(Offset: Integer): TDataField; 208 209 begin 209 210 Result := FDataFields.FieldByOffset[Offset]; … … 211 212 212 213 213 function T File.GetRawCacheID(Offset: Integer): Integer;214 function TResource.GetRawCacheID(Offset: Integer): Integer; 214 215 var 215 216 i: Integer; … … 221 222 end; 222 223 223 function T File.GetType: String;224 function TResource.GetType: String; 224 225 begin 225 226 Result := FFileInfo.Extension; 226 227 end; 227 228 228 function T File.GetCaption: String;229 function TResource.GetCaption: String; 229 230 begin 230 231 Result := FFileInfo.Name; … … 234 235 end; 235 236 236 function T File.GetChild(ID: Integer): TTreeElement;237 function TResource.GetChild(ID: Integer): TTreeElement; 237 238 begin 238 239 Result := FDataFields.Child[ID]; 239 240 end; 240 241 241 function T File.GetChildCount: Integer;242 function TResource.GetChildCount: Integer; 242 243 begin 243 244 if FDataFields <> nil then … … 248 249 249 250 250 function T File.GetEditor: TFrame;251 function TResource.GetEditor: TFrame; 251 252 begin 252 253 if not Assigned(FEditor) then … … 256 257 257 258 258 procedure T File.InitDataFields;259 procedure TResource.InitDataFields; 259 260 begin 260 261 if Assigned(FDataFields) then … … 265 266 266 267 267 procedure T File.InitEditor;268 procedure TResource.InitEditor; 268 269 begin 269 270 Exit; … … 274 275 //********************************************************* 275 276 //********************************************************* 276 procedure T File.ReCreateFile(fs: TStream);277 procedure TResource.ReCreateFile(fs: TStream); 277 278 const 278 279 temp0: array[0..31] of Byte = -
oup/current/FileClasses/_MetaManager.pas
r233 r248 7 7 TMetaManager = class 8 8 protected 9 FFiles: array of T File;9 FFiles: array of TResource; 10 10 FRoot: TExtensions; 11 11 FConnectionID: Integer; 12 12 FDataAccess: TObject; 13 13 function GetFileCount: Integer; 14 function GetFileById(Id: Integer): T File;14 function GetFileById(Id: Integer): TResource; 15 15 private 16 16 public … … 21 21 property Root: TExtensions read FRoot; 22 22 property FileCount: Integer read GetFileCount; 23 property FileById[Id: Integer]: T File read GetFileById;23 property FileById[Id: Integer]: TResource read GetFileById; 24 24 end; 25 25 … … 41 41 42 42 43 function TMetaManager.GetFileById(Id: Integer): T File;43 function TMetaManager.GetFileById(Id: Integer): TResource; 44 44 begin 45 45 InitFile(Id); … … 64 64 if finfo.Size > 0 then 65 65 begin 66 for typei := 0 to High( FileDescs) do66 for typei := 0 to High(ResourceDescs) do 67 67 begin 68 if FileDescs[typei].ext = finfo.Extension then68 if ResourceDescs[typei].ext = finfo.Extension then 69 69 begin 70 FFiles[id] := T FileClass(FileDescs[typei].ftype).Create(FConnectionID, id);70 FFiles[id] := TResourceClass(ResourceDescs[typei].ftype).Create(FConnectionID, id); 71 71 Break; 72 72 end; 73 73 end; 74 if typei > High( FileDescs) then74 if typei > High(ResourceDescs) then 75 75 FFiles[id] := TFile_Empty.Create(FConnectionID, id); 76 76 end else -
oup/current/FileClasses/_MetaTypes.pas
r245 r248 18 18 type 19 19 TTreeElement = _TreeElement.TTreeElement; 20 T File = _FileTypes.TFile;20 TResource = _FileTypes.TResource; 21 21 TFile_Empty = _EmptyFile.TFile_Empty; 22 22 TExtension = _Extensions.TExtension; … … 28 28 TArray = _DataTypes.TArray; 29 29 30 T FileID = _DataTypes.TFileID;30 TResourceID = _DataTypes.TResourceID; 31 31 TLevelID = _DataTypes.TLevelID; 32 32 TInt = _DataTypes.TInt; … … 39 39 TUnused = _DataTypes.TUnused; 40 40 41 T FileClass = class of TFile;42 T FileDesc = record41 TResourceClass = class of TResource; 42 TResourceDesc = record 43 43 ext: String; 44 ftype: T FileClass;44 ftype: TResourceClass; 45 45 end; 46 46 47 47 const 48 FileDescs: array[0..5] of TFileDesc = (48 ResourceDescs: array[0..5] of TResourceDesc = ( 49 49 (ext: 'AKEV'; ftype: TFile_AKEV), 50 50 (ext: 'AKVA'; ftype: TFile_AKVA), -
oup/current/Helper/LevelDB.pas
r241 r248 639 639 Application.ProcessMessages; 640 640 641 TAccess_OniArchive(Connection).UnloadWhenUnused := False;642 643 641 FileTime := Time; 644 642 Database.StartTransaction; … … 743 741 744 742 converting := False; 745 TAccess_OniArchive(Connection).UnloadWhenUnused := True;746 743 747 744 Query.Close; -
oup/current/Main.pas
r247 r248 509 509 entry.OnClick := menu_conns_itemClick; 510 510 menu_conns.Add(entry); 511 entry := nil;512 511 end; 513 512 end; … … 522 521 opend.Filter := 'Compatible level files|*.dat;*.oni;*.oldb|Oni level (*.dat)|*.dat|OniSplit Archive (*.oni)|*.oni|OUP level database (*.oldb)|*.oldb|Any (*.*)|*'; 523 522 if typedb then 524 opend.FilterIndex := 3523 opend.FilterIndex := 4 525 524 else 526 525 opend.FilterIndex := 2; -
oup/current/Settings.dfm
r112 r248 4 4 BorderStyle = bsToolWindow 5 5 Caption = 'Settings' 6 ClientHeight = 1976 ClientHeight = 216 7 7 ClientWidth = 321 8 8 Color = clBtnFace … … 16 16 OnCloseQuery = FormCloseQuery 17 17 OnShow = FormShow 18 DesignSize = ( 19 321 20 216) 18 21 PixelsPerInch = 96 19 22 TextHeight = 13 … … 29 32 object btn_ok: TButton 30 33 Left = 8 31 Top = 1 6834 Top = 187 32 35 Width = 57 33 36 Height = 23 37 Anchors = [akLeft, akBottom] 34 38 Caption = 'OK' 35 39 Default = True 36 40 TabOrder = 0 37 41 OnClick = btn_okClick 42 ExplicitTop = 168 38 43 end 39 44 object btn_cancel: TButton 40 45 Left = 112 41 Top = 1 6846 Top = 187 42 47 Width = 57 43 48 Height = 23 49 Anchors = [akLeft, akBottom] 44 50 Cancel = True 45 51 Caption = 'Cancel' 46 52 TabOrder = 1 47 53 OnClick = btn_cancelClick 54 ExplicitTop = 168 48 55 end 49 56 object combo_charset: TComboBox … … 86 93 object check_reg_oldb: TCheckBox 87 94 Left = 8 88 Top = 1 1095 Top = 133 89 96 Width = 180 90 97 Height = 17 … … 94 101 object check_reg_opf: TCheckBox 95 102 Left = 8 96 Top = 1 33103 Top = 156 97 104 Width = 180 98 105 Height = 17 … … 100 107 TabOrder = 6 101 108 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 102 117 end -
oup/current/Settings.pas
r204 r248 15 15 check_reg_oldb: TCheckBox; 16 16 check_reg_opf: TCheckBox; 17 check_reg_oni: TCheckBox; 17 18 procedure btn_cancelClick(Sender: TObject); 18 19 procedure btn_okClick(Sender: TObject); … … 118 119 RegisterExtension('.dat', 2, False); 119 120 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 120 135 if check_reg_oldb.Checked then 121 136 begin … … 168 183 if ExtensionRegistered('.dat', temps) then 169 184 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' 170 190 else 171 191 check_reg_dat.Checked := False; -
oup/current/Tools/BinEdit.dfm
r245 r248 107 107 Colors.EvenColumn = clNavy 108 108 Colors.CurrentOffsetBackground = clBtnShadow 109 Colors.OffsetBack Ground = clBtnFace109 Colors.OffsetBackground = clBtnFace 110 110 Colors.CurrentOffset = clBtnHighlight 111 111 Colors.Grid = clBtnFace … … 116 116 AllowInsertMode = False 117 117 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' 119 119 OnChange = hexChange 120 120 ShowPositionIfNotFocused = True -
oup/current/Tools/BinEdit.pas
r231 r248 141 141 // Self.SelectFileID(ConnectionID, fileid); 142 142 Self.ClearStructViewer; 143 ClearValues; 143 144 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; 150 154 end 151 155 else -
oup/current/Tools/MetaEditor.dfm
r244 r248 82 82 Caption = 'Meta Edit' 83 83 ImageIndex = 1 84 ExplicitLeft = 0 85 ExplicitTop = 0 86 ExplicitWidth = 0 87 ExplicitHeight = 0 84 88 end 85 89 object tab_hex: TTabSheet 86 90 Caption = 'Binary Edit' 91 ExplicitLeft = 0 92 ExplicitTop = 0 93 ExplicitWidth = 0 94 ExplicitHeight = 0 87 95 object splitter_hex_1: TSplitter 88 96 Left = 0 … … 162 170 Colors.EvenColumn = clNavy 163 171 Colors.CurrentOffsetBackground = clBtnShadow 164 Colors.OffsetBack Ground = clBtnFace172 Colors.OffsetBackground = clBtnFace 165 173 Colors.CurrentOffset = clBtnHighlight 166 174 Colors.Grid = clBtnFace … … 171 179 AllowInsertMode = False 172 180 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' 174 182 ShowPositionIfNotFocused = True 175 183 end -
oup/current/Tools/MetaEditor.pas
r244 r248 149 149 var 150 150 data: PNodeData; 151 ffile: T File;151 ffile: TResource; 152 152 //******************************************************************* 153 153 fs: TFileStream; … … 156 156 data := Sender.GetNodeData(Node); 157 157 ffile := nil; 158 if data.Field is T File then159 ffile := T File(data.Field);158 if data.Field is TResource then 159 ffile := TResource(data.Field); 160 160 if data.Field is _MetaTypes.TDatLink then 161 161 if Assigned(_MetaTypes.TDatLink(data.Field).TargetFile) then 162 ffile := T File(_MetaTypes.TDatLink(data.Field).TargetFile);162 ffile := TResource(_MetaTypes.TDatLink(data.Field).TargetFile); 163 163 if Assigned(ffile) then 164 164 begin … … 186 186 begin 187 187 data := Sender.GetNodeData(NewNode); 188 if data.Field is T File then189 begin 190 if Assigned(T File(data.Field).Editor) then191 Allowed := not T File(data.Field).Opened188 if data.Field is TResource then 189 begin 190 if Assigned(TResource(data.Field).Editor) then 191 Allowed := not TResource(data.Field).Opened 192 192 else 193 193 Allowed := True; … … 196 196 begin 197 197 data := Sender.GetNodeData(OldNode); 198 if data.Field is T File then199 begin 200 if T File(data.Field).Opened then198 if data.Field is TResource then 199 begin 200 if TResource(data.Field).Opened then 201 201 begin 202 202 if tab_meta.ControlCount > 0 then 203 203 for i := 0 to tab_meta.ControlCount - 1 do 204 204 tab_meta.RemoveControl(tab_meta.Controls[i]); 205 T File(data.Field).Opened := False;205 TResource(data.Field).Opened := False; 206 206 end; 207 207 end; … … 244 244 0: 245 245 begin 246 if Data.Field is T File then246 if Data.Field is TResource then 247 247 begin 248 if Length(T File(Data.Field).FileInfo.Name) = 0 then248 if Length(TResource(Data.Field).FileInfo.Name) = 0 then 249 249 TargetCanvas.Font.Color := $C06060; 250 if T File(Data.Field).FileInfo.Size = 0 then250 if TResource(Data.Field).FileInfo.Size = 0 then 251 251 TargetCanvas.Font.Color := $2020A0; 252 252 end; … … 267 267 i: Integer; 268 268 links: TStrings; 269 ifile: T File;269 ifile: TResource; 270 270 begin 271 271 inherited; … … 283 283 end; 284 284 end; 285 if data.Field is T File then285 if data.Field is TResource then 286 286 begin 287 ifile := T File(data.Field);287 ifile := TResource(data.Field); 288 288 case Column of 289 289 0: HintText := -
oup/current/Tools/_TemplateFileList.dfm
r241 r248 38 38 object tab_files: TTabSheet 39 39 Caption = 'Filelist' 40 ExplicitLeft = 0 41 ExplicitTop = 0 42 ExplicitWidth = 0 43 ExplicitHeight = 0 40 44 object panel_extension: TPanel 41 45 Left = 0 … … 220 224 Font.Name = 'Courier' 221 225 Font.Style = [] 222 ItemHeight = 13226 ItemHeight = 0 223 227 ParentFont = False 224 228 Sorted = True … … 270 274 Caption = 'Tree' 271 275 ImageIndex = 1 276 ExplicitLeft = 0 277 ExplicitTop = 0 278 ExplicitWidth = 0 279 ExplicitHeight = 0 272 280 object filelist_meta: TVirtualStringTree 273 281 Left = 0 -
oup/current/Tools/_TemplateFileList.pas
r233 r248 420 420 inherited; 421 421 data := Sender.GetNodeData(Node); 422 if data.Field is T File then422 if data.Field is TResource then 423 423 begin 424 424 if Assigned(FOnNewFileSelected) then 425 425 begin 426 FOnNewFileSelected(T File(data.Field).FileInfo);426 FOnNewFileSelected(TResource(data.Field).FileInfo); 427 427 end; 428 428 end; … … 437 437 inherited; 438 438 data := Sender.GetNodeData(NewNode); 439 if data.Field is T File then439 if data.Field is TResource then 440 440 begin 441 441 if Assigned(FOnNewFileSelecting) then 442 442 begin 443 FOnNewFileSelecting(T File(data.Field).FileInfo, Allowed);443 FOnNewFileSelecting(TResource(data.Field).FileInfo, Allowed); 444 444 end; 445 445 end; … … 519 519 begin 520 520 Data := Sender.GetNodeData(Node); 521 if Data.Field is T File then522 begin 523 if Length(T File(Data.Field).FileInfo.Name) = 0 then521 if Data.Field is TResource then 522 begin 523 if Length(TResource(Data.Field).FileInfo.Name) = 0 then 524 524 TargetCanvas.Font.Color := $C06060; 525 if T File(Data.Field).FileInfo.Size = 0 then525 if TResource(Data.Field).FileInfo.Size = 0 then 526 526 TargetCanvas.Font.Color := $2020A0; 527 527 end;
Note:
See TracChangeset
for help on using the changeset viewer.