Changeset 248 for oup/current/FileClasses
- Timestamp:
- Nov 26, 2007, 12:02:28 PM (17 years ago)
- Location:
- oup/current/FileClasses
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
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),
Note:
See TracChangeset
for help on using the changeset viewer.