Changeset 212
- Timestamp:
- Jun 12, 2007, 6:42:53 PM (17 years ago)
- Location:
- oup/current
- Files:
-
- 3 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/FileClasses/TXMP.pas
r210 r212 27 27 templist: TStringList; 28 28 begin 29 FDataFields := TBlock.Create(Self, 0, 'Base', '', nil);29 FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil); 30 30 templist := TStringList.Create; 31 31 with FDataFields do -
oup/current/FileClasses/_DataTypes.pas
r207 r212 14 14 FDataLength: Integer; 15 15 FParentFile: TObject; 16 FParentField: TDataField; 16 17 FChanged: Boolean; 17 18 function GetValueAsString: String; virtual; abstract; 18 19 public 19 constructor Create(ParentFile: TObject; Offset: Integer;20 Name, Description: String; ExtraArgs: Pointer); virtual;20 constructor Create(ParentFile: TObject; ParentField: TDataField; 21 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); virtual; 21 22 22 23 procedure Update(Offset, Length: Integer); virtual; abstract; … … 40 41 public 41 42 // ExtraArgs: keine 42 constructor Create(ParentFile: TObject; Offset: Integer;43 Name, Description: String; ExtraArgs: Pointer); override;43 constructor Create(ParentFile: TObject; ParentField: TDataField; 44 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 44 45 procedure Update(Offset, Length: Integer); override; 45 46 property FieldByOffset[Offset: Integer]: TDataField read GetFieldByOffset; … … 47 48 property FieldCount: Integer read GetFieldCount; 48 49 49 procedureAddField(fieldtype: TFieldType; Offset: Integer;50 Name, Description: String; ExtraArgs: Pointer) ;50 function AddField(fieldtype: TFieldType; Offset: Integer; 51 Name, Description: String; ExtraArgs: Pointer): TDataField; 51 52 end; 52 53 … … 58 59 public 59 60 // ExtraArgs: Pointer auf Integer: Bytes of TInt 60 constructor Create(ParentFile: TObject; Offset: Integer;61 Name, Description: String; ExtraArgs: Pointer); override;61 constructor Create(ParentFile: TObject; ParentField: TDataField; 62 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 62 63 procedure Update(Offset, Length: Integer); override; 63 64 end; … … 71 72 public 72 73 // ExtraArgs: Pointer auf TStringList 73 constructor Create(ParentFile: TObject; Offset: Integer;74 Name, Description: String; ExtraArgs: Pointer); override;74 constructor Create(ParentFile: TObject; ParentField: TDataField; 75 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 75 76 procedure Update(Offset, Length: Integer); override; 76 77 end; … … 83 84 public 84 85 // ExtraArgs: keine 85 constructor Create(ParentFile: TObject; Offset: Integer;86 Name, Description: String; ExtraArgs: Pointer); override;86 constructor Create(ParentFile: TObject; ParentField: TDataField; 87 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 87 88 procedure Update(Offset, Length: Integer); override; 88 89 end; … … 95 96 public 96 97 // ExtraArgs: keine 97 constructor Create(ParentFile: TObject; Offset: Integer;98 Name, Description: String; ExtraArgs: Pointer); override;98 constructor Create(ParentFile: TObject; ParentField: TDataField; 99 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 99 100 procedure Update(Offset, Length: Integer); override; 100 101 end; … … 108 109 public 109 110 // ExtraArgs: Pointer auf String: Possible Exts 110 constructor Create(ParentFile: TObject; Offset: Integer;111 Name, Description: String; ExtraArgs: Pointer); override;111 constructor Create(ParentFile: TObject; ParentField: TDataField; 112 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 112 113 procedure Update(Offset, Length: Integer); override; 113 114 end; … … 120 121 public 121 122 // ExtraArgs: Pointer auf Integer: Length 122 constructor Create(ParentFile: TObject; Offset: Integer;123 Name, Description: String; ExtraArgs: Pointer); override;123 constructor Create(ParentFile: TObject; ParentField: TDataField; 124 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 124 125 procedure Update(Offset, Length: Integer); override; 125 126 end; … … 134 135 public 135 136 // ExtraArgs: Pointer auf 2 Integer: Length+Count (packed record...) 136 constructor Create(ParentFile: TObject; Offset: Integer;137 Name, Description: String; ExtraArgs: Pointer); override;137 constructor Create(ParentFile: TObject; ParentField: TDataField; 138 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 138 139 procedure Update(Offset, Length: Integer); override; 139 140 property FieldByOffset[Offset: Integer]: TDataField read GetFieldByOffset; … … 141 142 property FieldCount: Integer read GetFieldCount; 142 143 143 procedureAddField(fieldtype: TFieldType; Offset: Integer;144 Name, Description: String; ExtraArgs: Pointer) ;144 function AddField(fieldtype: TFieldType; Offset: Integer; 145 Name, Description: String; ExtraArgs: Pointer): TDataField; 145 146 end; 146 147 … … 152 153 public 153 154 // ExtraArgs: keine 154 constructor Create(ParentFile: TObject; Offset: Integer;155 Name, Description: String; ExtraArgs: Pointer); override;155 constructor Create(ParentFile: TObject; ParentField: TDataField; 156 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 156 157 procedure Update(Offset, Length: Integer); override; 157 158 end; … … 163 164 public 164 165 // ExtraArgs: Pointer auf Integer: Length 165 constructor Create(ParentFile: TObject; Offset: Integer;166 Name, Description: String; ExtraArgs: Pointer); override;166 constructor Create(ParentFile: TObject; ParentField: TDataField; 167 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override; 167 168 procedure Update(Offset, Length: Integer); override; 168 169 end; … … 181 182 { TDataType } 182 183 183 constructor TDataField.Create(ParentFile: TObject; Offset: Integer;184 Name, Description: String; ExtraArgs: Pointer);184 constructor TDataField.Create(ParentFile: TObject; ParentField: TDataField; 185 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 185 186 begin 186 187 FOffset := Offset; 187 188 FName := Name; 188 189 FDescription := Description; 189 FParentFile := ParentFile; 190 FParentFile := ParentFile; 191 FParentField := ParentField; 190 192 end; 191 193 … … 194 196 { TString } 195 197 196 constructor TString.Create(ParentFile: TObject; Offset: Integer;197 Name, Description: String; ExtraArgs: Pointer);198 constructor TString.Create(ParentFile: TObject; ParentField: TDataField; 199 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 198 200 var 199 201 fstream: TMemoryStream; 200 202 i: Integer; 201 203 begin 202 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);204 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 203 205 FDataLength := Integer(ExtraArgs^); 204 206 fstream := TFile(ParentFile).FileStream; … … 228 230 { TInt } 229 231 230 constructor TInt.Create(ParentFile: TObject; Offset: Integer;231 Name, Description: String; ExtraArgs: Pointer);232 var 233 fstream: TMemoryStream; 234 begin 235 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);232 constructor TInt.Create(ParentFile: TObject; ParentField: TDataField; 233 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 234 var 235 fstream: TMemoryStream; 236 begin 237 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 236 238 FDataLength := Integer(ExtraArgs^); 237 239 FInt := 0; … … 255 257 { TArray } 256 258 257 procedureTArray.AddField(fieldtype: TFieldType; Offset: Integer;258 Name, Description: String; ExtraArgs: Pointer);259 begin 260 Exit; 261 end; 262 263 constructor TArray.Create(ParentFile: TObject; Offset: Integer;264 Name, Description: String; ExtraArgs: Pointer);265 begin 266 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);259 function TArray.AddField(fieldtype: TFieldType; Offset: Integer; 260 Name, Description: String; ExtraArgs: Pointer): TDataField; 261 begin 262 Exit; 263 end; 264 265 constructor TArray.Create(ParentFile: TObject; ParentField: TDataField; 266 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 267 begin 268 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 267 269 end; 268 270 … … 305 307 { TBlock } 306 308 307 procedureTBlock.AddField(fieldtype: TFieldType; Offset: Integer; Name,308 Description: String; ExtraArgs: Pointer);309 function TBlock.AddField(fieldtype: TFieldType; Offset: Integer; Name, 310 Description: String; ExtraArgs: Pointer): TDataField; 309 311 var 310 312 i: Integer; … … 323 325 SetLength(FDataFields, Length(FDataFields) + 1); 324 326 FDataFields[High(FDataFields)] := TFieldType(fieldtype).Create( 325 FParentFile, Offset, Name, Description, ExtraArgs); 326 end; 327 328 constructor TBlock.Create(ParentFile: TObject; Offset: Integer; 329 Name, Description: String; ExtraArgs: Pointer); 330 begin 331 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs); 327 FParentFile, Self, Offset, Name, Description, ExtraArgs); 328 Result := FDataFields[High(FDataFields)]; 329 end; 330 331 constructor TBlock.Create(ParentFile: TObject; ParentField: TDataField; 332 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 333 begin 334 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 332 335 end; 333 336 … … 356 359 { TLevelID } 357 360 358 constructor TLevelID.Create(ParentFile: TObject; Offset: Integer;359 Name, Description: String; ExtraArgs: Pointer);360 var 361 fstream: TMemoryStream; 362 begin 363 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);361 constructor TLevelID.Create(ParentFile: TObject; ParentField: TDataField; 362 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 363 var 364 fstream: TMemoryStream; 365 begin 366 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 364 367 FDataLength := 4; 365 368 fstream := TFile(ParentFile).FileStream; … … 383 386 { TFileID } 384 387 385 constructor TFileID.Create(ParentFile: TObject; Offset: Integer;386 Name, Description: String; ExtraArgs: Pointer);387 var 388 fstream: TMemoryStream; 389 begin 390 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);388 constructor TFileID.Create(ParentFile: TObject; ParentField: TDataField; 389 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 390 var 391 fstream: TMemoryStream; 392 begin 393 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 391 394 FDataLength := 4; 392 395 fstream := TFile(ParentFile).FileStream; … … 413 416 { TLinkByID } 414 417 415 constructor TLinkByID.Create(ParentFile: TObject; Offset: Integer; Name,416 Description: String; ExtraArgs: Pointer);417 var 418 fstream: TMemoryStream; 419 begin 420 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);418 constructor TLinkByID.Create(ParentFile: TObject; ParentField: TDataField; 419 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 420 var 421 fstream: TMemoryStream; 422 begin 423 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 421 424 FDataLength := 4; 422 425 FPosExts := String(ExtraArgs^); … … 444 447 { TRawLink } 445 448 446 constructor TRawLink.Create(ParentFile: TObject; Offset: Integer; Name,447 Description: String; ExtraArgs: Pointer);448 var 449 fstream: TMemoryStream; 450 begin 451 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);449 constructor TRawLink.Create(ParentFile: TObject; ParentField: TDataField; 450 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 451 var 452 fstream: TMemoryStream; 453 begin 454 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 452 455 FDataLength := 4; 453 456 fstream := TFile(ParentFile).FileStream; … … 470 473 { TUnused } 471 474 472 constructor TUnused.Create(ParentFile: TObject; Offset: Integer; Name,473 Description: String; ExtraArgs: Pointer);474 begin 475 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);475 constructor TUnused.Create(ParentFile: TObject; ParentField: TDataField; 476 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 477 begin 478 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 476 479 FDataLength := Integer(ExtraArgs^); 477 480 end; … … 491 494 { TBitSet } 492 495 493 constructor TBitSet.Create(ParentFile: TObject; Offset: Integer; Name,494 Description: String; ExtraArgs: Pointer);495 var 496 fstream: TMemoryStream; 497 begin 498 inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);496 constructor TBitSet.Create(ParentFile: TObject; ParentField: TDataField; 497 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 498 var 499 fstream: TMemoryStream; 500 begin 501 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 499 502 FNames := TStringList.Create; 500 503 FNames.AddStrings(TStringList(ExtraArgs^)); -
oup/current/FileClasses/_FileTypes.pas
r210 r212 17 17 FFileStream: TMemoryStream; 18 18 19 FCached: Boolean; 20 FChanged: Boolean; 21 19 22 FDatLinks: TDatLinkList; 20 23 FDataFields: TBlock; … … 31 34 function GetRawPartByOffset(Offset: Integer): TRawDataInfo; 32 35 function GetRawPartByIndex(ID: Integer): TRawDataInfo; 36 function GetChildCount: Integer; 33 37 public 34 38 constructor Create(ConnectionID, FileID: Integer); virtual; … … 42 46 property ConnectionID: Integer read FConnectionID; 43 47 48 property Cached: Boolean read FCached; 49 property Changed: Boolean read FChanged write FChanged; 50 51 property ChildCount: Integer read GetChildCount; 44 52 property LinkByOffset[Offset: Integer]: TDatLink read GetDatLinkByOffset; 45 53 property LinkByIndex[ID: Integer]: TDatLink read GetDatLinkByIndex; … … 63 71 64 72 uses 65 DatLinks, RawList, ConnectionManager, Dialogs ;73 DatLinks, RawList, ConnectionManager, Dialogs, _EmptyFile; 66 74 67 75 { TFileType } … … 79 87 FFileSize := fileinfo.Size; 80 88 81 FFileStream := TMemoryStream.Create; 82 ConManager.Connection[ConnectionID].LoadDatFile(FileID, TStream(FFileStream)); 89 FCached := False; 90 FChanged := False; 91 92 if not (Self is TFile_Empty) then 93 begin 94 FFileStream := TMemoryStream.Create; 95 ConManager.Connection[ConnectionID].LoadDatFile(FileID, TStream(FFileStream)); 96 end; 83 97 84 98 InitDatLinks(); … … 86 100 InitRawList(); 87 101 88 FFileStream.Free; 102 if not (Self is TFile_Empty) then 103 FFileStream.Free; 89 104 FFileStream := nil; 90 105 end; … … 97 112 98 113 function TFile.GetDatLinkByIndex(ID: Integer): TDatLink; 99 begin 100 if ID < Length(FDatLinks) then 101 Result := FDatLinks[ID] 114 var 115 i: Integer; 116 valids: Integer; 117 begin 118 if ID < GetChildCount then 119 begin 120 valids := 0; 121 i := 0; 122 repeat 123 if FDatLinks[i].DestID >= 0 then 124 begin 125 Inc(valids); 126 end; 127 Inc(i); 128 until valids > ID; 129 Result := FDatLinks[i - 1]; 130 end 102 131 else 103 132 with Result do … … 140 169 end; 141 170 171 172 function TFile.GetChildCount: Integer; 173 var 174 i: Integer; 175 begin 176 Result := Length(FDatLinks); 177 if Result > 0 then 178 begin 179 Result := 0; 180 for i := 0 to High(FDatLinks) do 181 if FDatLinks[i].DestID >= 0 then 182 Inc(Result); 183 end; 184 end; 142 185 143 186 function TFile.GetRawPartByIndex(ID: Integer): TRawDataInfo; -
oup/current/OniUnPacker.bdsproj
r209 r212 176 176 <Language Name="ProjectLang">$00000000</Language> 177 177 <Language Name="RootDir"></Language> 178 </Language> <Excluded_Packages> 178 </Language> 179 <Excluded_Packages> 179 180 <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages> 180 181 </Excluded_Packages> -
oup/current/OniUnPacker.dpr
r209 r212 34 34 TXMP in 'FileClasses\TXMP.pas', 35 35 MetaEditor in 'Tools\MetaEditor.pas' {Form_Meta}, 36 _FileManager in 'FileClasses\_FileManager.pas'; 36 _MetaManager in 'FileClasses\_MetaManager.pas', 37 _EmptyFile in 'FileClasses\_EmptyFile.pas', 38 TXAN in 'FileClasses\TXAN.pas'; 37 39 38 40 {$R *.res} -
oup/current/Tools/MetaEditor.dfm
r209 r212 3 3 Top = 0 4 4 Caption = 'Form_Meta' 5 ClientHeight = 2936 ClientWidth = 4 265 ClientHeight = 365 6 ClientWidth = 446 7 7 Color = clBtnFace 8 8 Font.Charset = DEFAULT_CHARSET … … 18 18 OnCreate = FormCreate 19 19 DesignSize = ( 20 4 2621 293)20 446 21 365) 22 22 PixelsPerInch = 96 23 23 TextHeight = 13 24 object Label3: TLabel 25 Left = 3 26 Top = 6 27 Width = 61 28 Height = 13 29 Caption = 'Connection: ' 30 end 24 31 object VST: TVirtualStringTree 25 Left = 826 Top = 827 Width = 38928 Height = 26532 Left = 4 33 Top = 44 34 Width = 409 35 Height = 321 29 36 Anchors = [akLeft, akTop, akRight, akBottom] 30 37 AnimationDuration = 0 … … 37 44 Header.Options = [hoColumnResize, hoDrag, hoVisible] 38 45 TabOrder = 0 46 TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoDeleteMovedNodes] 39 47 TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning] 40 TreeOptions.PaintOptions = [toShowDropmark, toShowRoot, toShowTreeLines, toThemeAware, toUseBlendedImages]41 48 OnGetText = VSTGetText 49 OnPaintText = VSTPaintText 50 OnInitChildren = VSTInitChildren 42 51 Columns = < 43 52 item 44 53 Position = 0 45 54 Width = 150 46 WideText = ' Main'55 WideText = 'FName' 47 56 end 48 57 item 49 58 Position = 1 59 WideText = 'FType' 60 end 61 item 62 Position = 2 63 WideText = 'FID' 64 end 65 item 66 Position = 3 50 67 WideText = 'Data' 51 68 end> 52 69 end 70 object Button1: TButton 71 Left = 204 72 Top = 1 73 Width = 75 74 Height = 25 75 Anchors = [akTop, akRight] 76 Caption = 'Load' 77 Default = True 78 TabOrder = 1 79 OnClick = Button1Click 80 end 81 object combo_connection: TComboBox 82 Left = 64 83 Top = 3 84 Width = 134 85 Height = 21 86 Style = csDropDownList 87 Anchors = [akLeft, akTop, akRight] 88 DropDownCount = 12 89 ItemHeight = 13 90 TabOrder = 2 91 end 53 92 end -
oup/current/Tools/MetaEditor.pas
r209 r212 3 3 uses 4 4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 Dialogs, VirtualTrees, _ FileManager;5 Dialogs, VirtualTrees, _MetaManager, StdCtrls; 6 6 7 7 type 8 8 TForm_Meta = class(TForm) 9 9 VST: TVirtualStringTree; 10 Button1: TButton; 11 Label3: TLabel; 12 combo_connection: TComboBox; 10 13 procedure FormClose(Sender: TObject; var Action: TCloseAction); 11 14 procedure FormCreate(Sender: TObject); 12 15 procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; 13 16 Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); 17 procedure Button1Click(Sender: TObject); 18 procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; 19 var ChildCount: Cardinal); 20 procedure VSTPaintText(Sender: TBaseVirtualTree; 21 const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; 22 TextType: TVSTTextType); 14 23 private 15 24 public 16 FileManager: TFileManager;25 MetaManager: TMetaManager; 17 26 end; 18 27 … … 22 31 implementation 23 32 uses 24 Data, _DataTypes, _FileTypes ;33 Data, _DataTypes, _FileTypes, ConnectionManager, TypeDefs, StrUtils; 25 34 {$R *.dfm} 26 35 … … 45 54 46 55 47 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); 48 begin 49 FileManager.Free; 50 Action := caFree; 51 end; 52 53 54 procedure TForm_Meta.FormCreate(Sender: TObject); 55 var 56 procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; 57 Node: PVirtualNode; var ChildCount: Cardinal); 58 var 59 data: PNodeData; 60 newdata: TNodeData; 61 newnode: PVirtualNode; 62 i: Integer; 63 id: Integer; 64 begin 65 data := VST.GetNodeData(node); 66 for i := 0 to MetaManager.FileById[TFile(data.Field).FileID].ChildCount - 1 do 67 begin 68 id := MetaManager.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID; 69 MetaManager.InitFile(id); 70 newdata.Field := MetaManager.FileById[id]; 71 newnode := AddVSTEntry(VST, Node, newdata); 72 if MetaManager.FileById[id].ChildCount > 0 then 73 VST.HasChildren[newnode] := True; 74 end; 75 ChildCount := MetaManager.FileById[TFile(data.Field).FileID].ChildCount; 76 end; 77 78 79 procedure TForm_Meta.Button1Click(Sender: TObject); 80 var 81 name: String; 82 conid: Integer; 83 56 84 a,b,c: Int64; 57 85 i: Integer; 58 86 data: TNodeData; 59 begin 87 node: PVirtualNode; 88 begin 89 if combo_connection.ItemIndex >= 0 then 90 begin 91 name := combo_connection.Items.Strings[combo_connection.ItemIndex]; 92 conid := StrToInt(MidStr(name, Pos('[', name) + 1, Pos(']', name) - Pos('[', name) - 1)); 93 94 QueryPerformanceFrequency(c); 95 QueryPerformanceCounter(a); 96 MetaManager := TMetaManager.Create(conid); 97 QueryPerformanceCounter(b); 98 ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's'); 99 100 VST.Clear; 101 VST.BeginUpdate; 102 for i := 0 to MetaManager.FileCount - 1 do 103 begin 104 if Assigned(MetaManager.FileById[i]) then 105 begin 106 data.Field := MetaManager.FileById[i]; 107 node := AddVSTEntry(VST, nil, data); 108 if MetaManager.FileById[i].ChildCount > 0 then 109 VST.HasChildren[node] := True; 110 end; 111 end; 112 VST.EndUpdate; 113 end; 114 end; 115 116 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); 117 begin 118 MetaManager.Free; 119 Action := caFree; 120 end; 121 122 123 procedure TForm_Meta.FormCreate(Sender: TObject); 124 var 125 i: Integer; 126 127 fn, datatype, boxstring: String; 128 level: Integer; 129 begin 130 combo_connection.ItemIndex := -1; 131 combo_connection.Items.Clear; 132 if ConManager.Count > 0 then 133 begin 134 for i := 0 to ConManager.Count - 1 do 135 begin 136 level := ConManager.ConnectionByIndex[i].LevelNumber; 137 fn := ExtractFileName(ConManager.ConnectionByIndex[i].FileName); 138 if ConManager.ConnectionByIndex[i].Backend = DB_ONI then 139 datatype := 'ONI-.dat: ' 140 else if ConManager.ConnectionByIndex[i].Backend = DB_ADB then 141 datatype := 'OUP-DB: ' 142 else 143 datatype := 'Unknown: '; 144 boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ') [' + IntToStr(ConManager.ConnectionByIndex[i].ConnectionID) + ']'; 145 combo_connection.Items.Add(boxstring); 146 end; 147 if combo_connection.ItemIndex = -1 then 148 begin 149 combo_connection.ItemIndex := 0; 150 end; 151 end; 152 153 60 154 VST.NodeDataSize := SizeOf(TNodeData); 61 155 VST.Font.Charset := AppSettings.CharSet; 62 156 VST.Clear; 63 64 QueryPerformanceFrequency(c);65 QueryPerformanceCounter(a);66 FileManager := TFileManager.Create(1);67 QueryPerformanceCounter(b);68 ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's');69 70 for i := 0 to FileManager.FileCount - 1 do71 begin72 data.Field := FileManager.FileById[i];73 AddVSTEntry(VST, nil, data);74 end;75 157 end; 76 158 … … 87 169 begin 88 170 case Column of 89 0: begin 90 if Data.Field is TFile then 91 begin 92 CellText := TFile(Data.Field).FileName; 93 end; 94 end; 95 { 0: 96 CellText := Data.Caption; 171 0: 172 begin 173 if Data.Field is TFile then 174 begin 175 CellText := TFile(Data.Field).FileName; 176 if CellText = '' then 177 CellText := 'Unnamed'; 178 end; 179 end; 97 180 1: 98 if Data.DataType > 0 then99 CellText := '0x' + IntToHex(Data.Offset, 8)100 else if Data.Offset > 0 then101 CellText := '0x' + IntToHex(Data.Offset, 8);181 begin 182 if Data.Field is TFile then 183 CellText := TFile(Data.Field).FileExt; 184 end; 102 185 2: 103 if Data.DataType > 0 then 104 CellText := GetDataType(Data.DataType); 105 3: 106 if Data.DataType > 0 then 107 CellText := Data.Value //GetValue(data.DataType, data.Offset) 108 else if Length(Data.Value) > 0 then 109 CellText := IntToStr(StrToInt(Data.Value)) + ' Bytes'; 110 4: 111 CellText := Data.Description; 112 } end; 186 begin 187 if Data.Field is TFile then 188 CellText := IntToStr(TFile(Data.Field).FileID); 189 end; 190 end; 191 end; 192 end; 193 194 procedure TForm_Meta.VSTPaintText(Sender: TBaseVirtualTree; 195 const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; 196 TextType: TVSTTextType); 197 var 198 Data: PNodeData; 199 begin 200 Data := Sender.GetNodeData(Node); 201 if TextType = ttNormal then 202 begin 203 case Column of 204 0: 205 begin 206 if Data.Field is TFile then 207 if Length(TFile(Data.Field).FileName) = 0 then 208 TargetCanvas.Font.Color := $000060; 209 end; 210 end; 113 211 end; 114 212 end;
Note:
See TracChangeset
for help on using the changeset viewer.