- Timestamp:
- Jun 21, 2007, 12:24:04 AM (18 years ago)
- Location:
- oup/current
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/DataAccess/Access_OniArchive.pas
r229 r231 370 370 if fileid < GetFileCount then 371 371 begin 372 if not Assigned(Target) then 373 Target := TMemoryStream.Create; 374 if not FDatOpened then 375 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite); 376 Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning); 377 streampos := Target.Position; 378 Target.CopyFrom(Fdat_file, Fdat_files[fileid].Size); 379 Target.Seek(streampos, soFromBeginning); 380 if UnloadWhenUnused then 381 begin 382 Fdat_file.Free; 383 FDatOpened := False; 384 end 385 else 386 FDatOpened := True; 372 if GetFileInfo(FileID).Size > 0 then 373 begin 374 if not Assigned(Target) then 375 Target := TMemoryStream.Create; 376 if not FDatOpened then 377 Fdat_file := TFileStream.Create(FFileName, fmOpenReadWrite); 378 Fdat_file.Seek(Fdat_files[fileid].DatAddr, soFromBeginning); 379 streampos := Target.Position; 380 Target.CopyFrom(Fdat_file, Fdat_files[fileid].Size); 381 Target.Seek(streampos, soFromBeginning); 382 if UnloadWhenUnused then 383 begin 384 Fdat_file.Free; 385 FDatOpened := False; 386 end 387 else 388 FDatOpened := True; 389 end; 387 390 end; 388 391 end; -
oup/current/FileClasses/_Extensions.pas
r229 r231 2 2 3 3 interface 4 5 uses 6 _FileTypes; 4 7 5 8 type -
oup/current/FileClasses/_FileTypes.pas
r216 r231 11 11 protected 12 12 FConnectionID: Integer; 13 FFileID: Integer; 14 FFileName: String; 15 FFileExt: String; 16 FFileSize: Integer; 13 FFileInfo: TFileInfo; 17 14 FFileStream: TMemoryStream; 18 15 … … 45 42 46 43 property FileStream: TMemoryStream read FFileStream; 47 property FileID: Integer read FFileID; 48 property FileName: String read FFileName; 49 property FileExt: String read FFileExt; 50 property FileSize: Integer read FFileSize; 44 property FileInfo: TFileInfo read FFileInfo; 51 45 property ConnectionID: Integer read FConnectionID; 52 46 … … 84 78 85 79 constructor TFile.Create(ConnectionID, FileID: Integer); 86 var87 fileinfo: TFileInfo;88 80 begin 89 81 FConnectionID := ConnectionID; 90 FFileID := FileID; 91 fileinfo := ConManager.Connection[ConnectionID].GetFileInfo(FileID); 92 FFileName := fileinfo.Name; 93 FFileExt := fileinfo.Extension; 94 FFileSize := fileinfo.Size; 82 FFileInfo := ConManager.Connection[ConnectionID].GetFileInfo(FileID); 95 83 96 84 FCached := False; … … 235 223 procedure TFile.InitDatLinks; 236 224 begin 237 FDatLinks := ConManager.Connection[FConnectionID].GetDatLinks(FFileI D);225 FDatLinks := ConManager.Connection[FConnectionID].GetDatLinks(FFileInfo.ID); 238 226 end; 239 227 … … 245 233 procedure TFile.InitRawList; 246 234 begin 247 FRawParts := ConManager.Connection[FConnectionID].GetRawList(FFileI D);235 FRawParts := ConManager.Connection[FConnectionID].GetRawList(FFileInfo.ID); 248 236 end; 249 237 -
oup/current/Tools/BinEdit.dfm
r225 r231 4 4 OnCreate = FormCreate 5 5 OnKeyUp = FormKeyUp 6 ExplicitWidth = 3207 ExplicitHeight = 2408 6 PixelsPerInch = 96 9 7 TextHeight = 13 … … 19 17 ExplicitHeight = 318 20 18 end 19 end 20 inherited tab_meta: TTabSheet 21 ExplicitLeft = 0 22 ExplicitTop = 0 23 ExplicitWidth = 0 24 ExplicitHeight = 0 21 25 end 22 26 end … … 133 137 OnDblClick = value_viewerDblClick 134 138 OnMouseDown = value_viewerMouseDown 135 ExplicitHeight = 218136 139 end 137 140 object VST: TVirtualStringTree -
oup/current/Tools/BinEdit.pas
r225 r231 30 30 procedure NewFile(fileinfo: TFileInfo); 31 31 32 procedure LoadDat(_fileid: Integer);33 32 function Save: Boolean; 34 33 function GetValue(datatype: Word; offset: Integer): String; … … 121 120 122 121 procedure TForm_BinEdit.NewFile(fileinfo: TFileInfo); 123 begin124 LoadDat(fileinfo.ID);125 end;126 127 128 129 130 function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode;131 ARecord: TNodeData): PVirtualNode;132 var133 Data: PNodeData;134 begin135 Result := AVST.AddChild(ANode);136 Data := AVST.GetNodeData(Result);137 AVST.ValidateNode(Result, False);138 Data^ := ARecord;139 end;140 141 142 143 144 procedure TForm_BinEdit.LoadDat(_fileid: Integer);145 122 var 146 123 mem: TMemoryStream; … … 157 134 end; 158 135 end; 159 if _fileid>= 0 then160 begin 161 fileid := _fileid;136 if fileinfo.ID >= 0 then 137 begin 138 fileid := fileinfo.ID; 162 139 ConID := ConnectionID; 163 if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]) <> fileid then164 Self.SelectFileID(ConnectionID, fileid);140 // if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]) <> fileid then 141 // Self.SelectFileID(ConnectionID, fileid); 165 142 Self.ClearStructViewer; 166 143 mem := nil; … … 174 151 else 175 152 begin 176 fileid := _fileid;153 fileid := -1; 177 154 ConID := -1; 178 155 Self.ClearStructViewer; … … 182 159 end; 183 160 end; 161 162 163 164 165 function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode; 166 ARecord: TNodeData): PVirtualNode; 167 var 168 Data: PNodeData; 169 begin 170 Result := AVST.AddChild(ANode); 171 Data := AVST.GetNodeData(Result); 172 AVST.ValidateNode(Result, False); 173 Data^ := ARecord; 174 end; 175 176 184 177 185 178 -
oup/current/Tools/FileManager.dfm
r228 r231 3 3 PixelsPerInch = 96 4 4 TextHeight = 13 5 inherited panel_basecontent: TPanel 6 inherited panel_files: TPanel 7 inherited FilePages: TPageControl 8 inherited tab_files: TTabSheet 9 Caption = 'File list' 10 end 11 end 12 end 13 end 5 14 end -
oup/current/Tools/MetaEditor.pas
r229 r231 34 34 implementation 35 35 {$R *.dfm} 36 uses _MetaManager, _ FileTypes, Data;36 uses _MetaManager, _MetaTypes, ConnectionManager, Data; 37 37 38 38 type … … 57 57 procedure TForm_Meta.NewCon(ID: Integer); 58 58 var 59 a,b,c: Int64;60 59 i: Integer; 61 60 data: TNodeData; 62 61 node: PVirtualNode; 63 begin 64 { 62 Meta: TMetaManager; 63 begin 65 64 if ID >= 0 then 66 65 begin 67 QueryPerformanceFrequency(c);68 QueryPerformanceCounter(a);69 if not Assigned(Meta) then70 Meta := TMetaManager.Create(ID, Self);71 QueryPerformanceCounter(b);72 ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's');73 74 66 VST.Clear; 75 67 VST.BeginUpdate; 68 Meta := ConManager.Connection[ID].MetaData; 76 69 for i := 0 to Meta.FileCount - 1 do 77 70 begin … … 86 79 VST.EndUpdate; 87 80 end; 88 }89 81 end; 90 82 … … 98 90 i: Integer; 99 91 id: Integer; 100 begin 101 { 102 data := VST.GetNodeData(node); 103 for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do 104 begin 105 id := Meta.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID; 92 Meta: TMetaManager; 93 begin 94 data := Sender.GetNodeData(node); 95 Meta := ConManager.Connection[ID].MetaData; 96 for i := 0 to TFile(data.Field).ChildCount - 1 do 97 begin 98 id := TFile(data.Field).LinkByIndex[i].DestID; 106 99 Meta.InitFile(id); 107 100 newdata.Field := Meta.FileById[id]; 108 newnode := AddVSTEntry( VST, Node, newdata);101 newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); 109 102 if Meta.FileById[id].ChildCount > 0 then 110 VST.HasChildren[newnode] := True; 111 end; 112 ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount; 113 } 103 Sender.HasChildren[newnode] := True; 104 end; 105 ChildCount := Sender.ChildCount[Node]; 114 106 end; 115 107 … … 180 172 if Data.Field is TFile then 181 173 begin 182 CellText := TFile(Data.Field).File Name;174 CellText := TFile(Data.Field).FileInfo.Name; 183 175 if CellText = '' then 184 176 CellText := 'Unnamed'; … … 188 180 begin 189 181 if Data.Field is TFile then 190 CellText := TFile(Data.Field).File Ext;182 CellText := TFile(Data.Field).FileInfo.Extension; 191 183 end; 192 184 2: 193 185 begin 194 186 if Data.Field is TFile then 195 CellText := IntToStr(TFile(Data.Field).FileI D);187 CellText := IntToStr(TFile(Data.Field).FileInfo.ID); 196 188 end; 197 189 end; … … 214 206 if Data.Field is TFile then 215 207 begin 216 if Length(TFile(Data.Field).File Name) = 0 then208 if Length(TFile(Data.Field).FileInfo.Name) = 0 then 217 209 TargetCanvas.Font.Color := $C06060; 218 if TFile(Data.Field).File Size = 0 then210 if TFile(Data.Field).FileInfo.Size = 0 then 219 211 TargetCanvas.Font.Color := $2020A0; 220 212 end; -
oup/current/Tools/_TemplateFileList.dfm
r229 r231 37 37 TabOrder = 0 38 38 object tab_files: TTabSheet 39 Caption = 'File s'39 Caption = 'Filelist' 40 40 object panel_extension: TPanel 41 41 Left = 0 … … 267 267 end 268 268 object tab_meta: TTabSheet 269 Caption = ' Meta'269 Caption = 'Tree' 270 270 ImageIndex = 1 271 271 object filelist_meta: TVirtualStringTree … … 284 284 Header.Options = [hoColumnResize, hoDrag] 285 285 TabOrder = 0 286 OnFocusChanged = filelist_metaFocusChanged 287 OnFocusChanging = filelist_metaFocusChanging 286 288 OnGetText = filelist_metaGetText 287 289 OnPaintText = filelist_metaPaintText -
oup/current/Tools/_TemplateFileList.pas
r230 r231 9 9 10 10 type 11 TNewFileSelectingEvent = procedure(FileInfo: TFileInfo; var allowed: Boolean) of object; 12 11 13 TForm_TemplateFileList = class(TForm_TemplateFile) 12 14 panel_files: TPanel; … … 62 64 const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; 63 65 TextType: TVSTTextType); 66 procedure filelist_metaFocusChanging(Sender: TBaseVirtualTree; OldNode, 67 NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; 68 var Allowed: Boolean); 69 procedure filelist_metaFocusChanged(Sender: TBaseVirtualTree; 70 Node: PVirtualNode; Column: TColumnIndex); 64 71 private 65 72 FSortBy: TSortType; 66 73 FAllowedExts: String; 67 74 FAllowMultiSelect: Boolean; 75 FOnNewFileSelecting: TNewFileSelectingEvent; 68 76 procedure SetAllowedExts(exts: String); 69 77 procedure SetMultiSelect(allow: Boolean); … … 75 83 property AllowedExts: String read FAllowedExts write SetAllowedExts; 76 84 property AllowMultiSelect: Boolean read FAllowMultiSelect write SetMultiSelect; 85 property OnNewFileSelecting: TNewFileSelectingEvent read FOnNewFileSelecting write FOnNewFileSelecting; 77 86 end; 78 87 … … 404 413 405 414 415 procedure TForm_TemplateFileList.filelist_metaFocusChanged( 416 Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex); 417 var 418 data: PNodeData; 419 begin 420 inherited; 421 data := Sender.GetNodeData(Node); 422 if data.Field is TFile then 423 begin 424 if Assigned(FOnNewFileSelected) then 425 begin 426 FOnNewFileSelected(TFile(data.Field).FileInfo); 427 end; 428 end; 429 end; 430 431 procedure TForm_TemplateFileList.filelist_metaFocusChanging( 432 Sender: TBaseVirtualTree; OldNode, NewNode: PVirtualNode; OldColumn, 433 NewColumn: TColumnIndex; var Allowed: Boolean); 434 var 435 data: PNodeData; 436 begin 437 inherited; 438 data := Sender.GetNodeData(NewNode); 439 if data.Field is TFile then 440 begin 441 if Assigned(FOnNewFileSelecting) then 442 begin 443 FOnNewFileSelecting(TFile(data.Field).FileInfo, Allowed); 444 end; 445 end; 446 end; 447 406 448 procedure TForm_TemplateFileList.filelist_metaGetText(Sender: TBaseVirtualTree; 407 449 Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; … … 418 460 if data.Field is TFile then 419 461 begin 420 if TFile(data.Field).File Name = '' then421 CellText := TFile(data.Field).File Ext+ ' (unnamed)'462 if TFile(data.Field).FileInfo.Name = '' then 463 CellText := TFile(data.Field).FileInfo.Extension + ' (unnamed)' 422 464 else 423 CellText := TFile(data.Field).File Ext + ': ' + TFile(data.Field).FileName;465 CellText := TFile(data.Field).FileInfo.Extension + ': ' + TFile(data.Field).FileInfo.Name; 424 466 end; 425 467 end; … … 479 521 if Data.Field is TFile then 480 522 begin 481 if Length(TFile(Data.Field).File Name) = 0 then523 if Length(TFile(Data.Field).FileInfo.Name) = 0 then 482 524 TargetCanvas.Font.Color := $C06060; 483 if TFile(Data.Field).File Size = 0 then525 if TFile(Data.Field).FileInfo.Size = 0 then 484 526 TargetCanvas.Font.Color := $2020A0; 485 527 end;
Note:
See TracChangeset
for help on using the changeset viewer.