| 4 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 5 | 
   | 
 uses | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 | 
   | 
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 < | 
   Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 > | 
   Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls, ComCtrls, Grids, | 
 
 
 
 
 
 | 8 | 
 > | 
   MPHexEditor, Wrapgrid; | 
 
 
 
 
 
 
 
 
 
 
 
 | 9 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 10 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
   | 
   TForm_Meta = class(TForm_BaseTemplate) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
   | 
     VST: TVirtualStringTree; | 
 
 
 
 
 
 
 
 
 
 | 12 | 
 – | 
     Panel2: TPanel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 13 | 
   | 
     splitter: TSplitter; | 
 
 
 
 
 
 
 
 
 | 14 | 
 + | 
     rightPages: TPageControl; | 
 
 
 
 
 
 
 
 
 | 15 | 
 + | 
     tab_hex: TTabSheet; | 
 
 
 
 
 
 
 
 
 | 16 | 
 + | 
     tab_meta: TTabSheet; | 
 
 
 
 
 
 
 
 
 | 17 | 
 + | 
     panel_hex_actions: TPanel; | 
 
 
 
 
 
 
 
 
 | 18 | 
 + | 
     hex: TMPHexEditor; | 
 
 
 
 
 
 
 
 
 | 19 | 
 + | 
     splitter_hex_1: TSplitter; | 
 
 
 
 
 
 
 
 
 | 20 | 
 + | 
     value_viewer: TWrapGrid; | 
 
 
 
 
 
 
 
 
 | 21 | 
 + | 
     splitter_hex_2: TSplitter; | 
 
 
 
 
 
 
 
 
 | 22 | 
 + | 
     structviewer: TVirtualStringTree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 | 
   | 
     procedure FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 | 
   | 
     procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 | 
   | 
       var ChildCount: Cardinal); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 42 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 43 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 44 | 
   | 
 {$R *.dfm} | 
 
 
 
 
 
 
 
 
 
 
 
 | 45 | 
 < | 
 uses _MetaManager, _MetaTypes, ConnectionManager, Data; | 
 
 
 
 
 
 
 
 
 
 | 45 | 
 > | 
 uses _MetaManager, _MetaTypes, ConnectionManager, Data, _FileTypes; | 
 
 
 
 
 
 
 
 
 
 
 
 | 46 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 47 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 48 | 
   | 
   PNodeData = ^TNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 | 
   | 
   data: TNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | 
   | 
   node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 71 | 
   | 
   Meta: TMetaManager; | 
 
 
 
 
 
 
 
 
 | 72 | 
 + | 
   root: TExtensions; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 73 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 74 | 
   | 
   if ID >= 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 75 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 | 76 | 
 + | 
     //VST | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 77 | 
   | 
     VST.Clear; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 78 | 
   | 
     VST.BeginUpdate; | 
 
 
 
 
 
 
 
 
 
 
 
 | 79 | 
 < | 
     Meta := ConManager.Connection[ID].MetaData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 80 | 
 < | 
     for i := 0 to Meta.FileCount - 1 do | 
 
 
 
 
 
 
 
 
 
 | 79 | 
 > | 
     root := ConManager.Connection[FConnectionID].MetaData.Root; | 
 
 
 
 
 
 | 80 | 
 > | 
     for i := 0 to High(root) do | 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | 
 < | 
       if Assigned(Meta.FileById[i]) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
 < | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
 < | 
         data.Field := Meta.FileById[i]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 74 | 
 < | 
         node := AddVSTEntry(VST, nil, data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 75 | 
 < | 
         if Meta.FileById[i].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 76 | 
 < | 
           VST.HasChildren[node] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 77 | 
 < | 
       end; | 
 
 
 
 
 
 
 
 
 
 | 82 | 
 > | 
       data.Field := root[i]; | 
 
 
 
 
 
 | 83 | 
 > | 
       node := AddVSTEntry(VST, nil, data); | 
 
 
 
 
 
 | 84 | 
 > | 
       VST.HasChildren[node] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 85 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 86 | 
   | 
     VST.EndUpdate; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 87 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 99 | 
   | 
   Meta: TMetaManager; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
   | 
   data := Sender.GetNodeData(node); | 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
 < | 
   Meta := ConManager.Connection[ID].MetaData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
 < | 
   for i := 0 to TFile(data.Field).ChildCount - 1 do | 
 
 
 
 
 
 
 
 
 
 | 102 | 
 > | 
   Meta := ConManager.Connection[ConnectionID].MetaData; | 
 
 
 
 
 
 | 103 | 
 > | 
   if data.Field is TFile then | 
 
 
 
 
 
 
 
 
 
 
 
 | 104 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
 < | 
     id := TFile(data.Field).LinkByIndex[i].DestID; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
 < | 
     Meta.InitFile(id); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 | 
 < | 
     newdata.Field := Meta.FileById[id]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 108 | 
 < | 
     newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 109 | 
 < | 
     if Meta.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 110 | 
 < | 
       Sender.HasChildren[newnode] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
 > | 
     if TFile(data.Field).ChildCount > 0 then | 
 
 
 
 
 
 | 106 | 
 > | 
     begin | 
 
 
 
 
 
 | 107 | 
 > | 
       for i := 0 to TFile(data.Field).ChildCount - 1 do | 
 
 
 
 
 
 | 108 | 
 > | 
       begin | 
 
 
 
 
 
 | 109 | 
 > | 
         id := TFile(data.Field).LinkByIndex[i].DestID; | 
 
 
 
 
 
 | 110 | 
 > | 
         Meta.InitFile(id); | 
 
 
 
 
 
 | 111 | 
 > | 
         newdata.Field := Meta.FileById[id]; | 
 
 
 
 
 
 | 112 | 
 > | 
         newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); | 
 
 
 
 
 
 | 113 | 
 > | 
         if Meta.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 | 114 | 
 > | 
           Sender.HasChildren[newnode] := True; | 
 
 
 
 
 
 | 115 | 
 > | 
       end; | 
 
 
 
 
 
 | 116 | 
 > | 
     end; | 
 
 
 
 
 
 | 117 | 
 > | 
     if TFile(data.Field).RawCount > 0 then | 
 
 
 
 
 
 | 118 | 
 > | 
     begin | 
 
 
 
 
 
 | 119 | 
 > | 
       for i := 0 to TFile(data.Field).RawCount - 1 do | 
 
 
 
 
 
 | 120 | 
 > | 
       begin | 
 
 
 
 
 
 | 121 | 
 > | 
 //        Exit; | 
 
 
 
 
 
 | 122 | 
 > | 
       end; | 
 
 
 
 
 
 | 123 | 
 > | 
     end; | 
 
 
 
 
 
 | 124 | 
 > | 
   end; | 
 
 
 
 
 
 | 125 | 
 > | 
   if data.Field is TExtension then | 
 
 
 
 
 
 | 126 | 
 > | 
   begin | 
 
 
 
 
 
 | 127 | 
 > | 
     if TExtension(data.Field).FileCount = 0 then | 
 
 
 
 
 
 | 128 | 
 > | 
       TExtension(data.Field).InitList; | 
 
 
 
 
 
 | 129 | 
 > | 
     for i := 0 to TExtension(data.Field).FileCount - 1 do | 
 
 
 
 
 
 | 130 | 
 > | 
     begin | 
 
 
 
 
 
 | 131 | 
 > | 
       id := TExtension(data.Field).Files[i]; | 
 
 
 
 
 
 | 132 | 
 > | 
       Meta.InitFile(id); | 
 
 
 
 
 
 | 133 | 
 > | 
       newdata.Field := Meta.FileById[id]; | 
 
 
 
 
 
 | 134 | 
 > | 
       newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); | 
 
 
 
 
 
 | 135 | 
 > | 
       if Meta.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 | 136 | 
 > | 
         Sender.HasChildren[newnode] := True; | 
 
 
 
 
 
 | 137 | 
 > | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 138 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 139 | 
   | 
   ChildCount := Sender.ChildCount[Node]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 140 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 | 
   | 
     TFile(data.Field).InitEditor; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 | 
   | 
     if Assigned(TFile(data.Field).Editor) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 153 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 154 | 
 < | 
       panel2.InsertControl(TFile(data.Field).Editor); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 154 | 
 > | 
       TFile(data.Field).Editor.Align := alClient; | 
 
 
 
 
 
 | 155 | 
 > | 
       tab_meta.InsertControl(TFile(data.Field).Editor); | 
 
 
 
 
 
 
 
 
 
 
 
 | 156 | 
   | 
       TFile(data.Field).Opened := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 157 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 158 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 182 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 183 | 
   | 
       if TFile(data.Field).Opened then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 184 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 185 | 
 < | 
         if panel2.ControlCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 186 | 
 < | 
           for i := 0 to panel2.ControlCount - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 187 | 
 < | 
             panel2.RemoveControl(panel2.Controls[i]); | 
 
 
 
 
 
 
 
 
 
 | 185 | 
 > | 
         if tab_meta.ControlCount > 0 then | 
 
 
 
 
 
 | 186 | 
 > | 
           for i := 0 to tab_meta.ControlCount - 1 do | 
 
 
 
 
 
 | 187 | 
 > | 
             tab_meta.RemoveControl(tab_meta.Controls[i]); | 
 
 
 
 
 
 
 
 
 
 
 
 | 188 | 
   | 
         TFile(data.Field).Opened := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 189 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 190 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 210 | 
   | 
             if CellText = '' then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 211 | 
   | 
               CellText := 'Unnamed'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 212 | 
   | 
           end; | 
 
 
 
 
 
 
 
 
 | 213 | 
 + | 
           if Data.Field is TExtension then | 
 
 
 
 
 
 
 
 
 | 214 | 
 + | 
             CellText := TExtension(Data.Field).Ext; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 215 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 216 | 
   | 
       1: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 217 | 
   | 
         begin |