Changeset 341 for tools


Ignore:
Timestamp:
Feb 27, 2010, 8:06:39 PM (15 years ago)
Author:
maron
Message:

Místo cyklu prohledávájící v datách entry vytvoření tabulky indexů, zkrácení průchodu osou X při přepisování textů

Location:
tools/dbc_export
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tools/dbc_export/DBCExport.lpi

    r340 r341  
    2727      <local>
    2828        <FormatVersion Value="1"/>
    29         <CommandLineParams Value="-f ../../../trunk/source/3.3.0/dbc/GameTips.dbc -n test.dbc -c usuuuuuuuuuuuuuuuu -q &quot;SELECT T.entry as entry,T.Text as text0 FROM (SELECT * FROM gametips WHERE (Complete = 1) AND ((Language = 1)) AND (User IN (459,670,602,462,1,400,638,592,624,610,769,331,131,704,2,499,641,660,578,337,304,277,208,613,768,754,590,606,26,618,739,503,601,607,585,596,765,320,547,687)) AND VersionStart <= 9947 AND VersionEnd >= 9947) AS T GROUP BY T.entry&quot;"/>
     29        <CommandLineParams Value="-f ../../../trunk/source/3.3.0/dbc/GameTips.dbc -n test.dbc -c usuuuuuuuuuuuuuuuu -q &quot;SELECT T.entry as entry,T.Text as text1 FROM (SELECT * FROM gametips WHERE (Complete = 1) AND ((Language = 1)) AND (User IN (459,670,602,462,1,400,638,592,624,610,769,331,131,704,2,499,641,660,578,337,304,277,208,613,768,754,590,606,26,618,739,503,601,607,585,596,765,320,547,687)) AND VersionStart <= 9947 AND VersionEnd >= 9947) AS T GROUP BY T.entry&quot;"/>
    3030        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
    3131      </local>
     
    3636        <IsPartOfProject Value="True"/>
    3737        <UnitName Value="DBCExport"/>
    38         <CursorPos X="1" Y="200"/>
    39         <TopLine Value="180"/>
     38        <CursorPos X="1" Y="199"/>
     39        <TopLine Value="196"/>
    4040        <EditorIndex Value="0"/>
    41         <UsageCount Value="45"/>
     41        <UsageCount Value="48"/>
    4242        <Loaded Value="True"/>
    4343        <SyntaxHighlighter Value="Delphi"/>
     
    118118        <TopLine Value="16"/>
    119119        <EditorIndex Value="3"/>
    120         <UsageCount Value="36"/>
     120        <UsageCount Value="39"/>
    121121        <Loaded Value="True"/>
    122122        <SyntaxHighlighter Value="Delphi"/>
     
    129129        <TopLine Value="116"/>
    130130        <EditorIndex Value="1"/>
    131         <UsageCount Value="36"/>
     131        <UsageCount Value="39"/>
    132132        <Loaded Value="True"/>
    133133        <SyntaxHighlighter Value="Delphi"/>
     
    139139        <TopLine Value="1"/>
    140140        <EditorIndex Value="2"/>
    141         <UsageCount Value="36"/>
     141        <UsageCount Value="39"/>
    142142        <Loaded Value="True"/>
    143143        <SyntaxHighlighter Value="None"/>
     
    154154      <Position1>
    155155        <Filename Value="DBCExport.pas"/>
    156         <Caret Line="188" Column="1" TopLine="174"/>
     156        <Caret Line="192" Column="1" TopLine="178"/>
    157157      </Position1>
    158158      <Position2>
    159159        <Filename Value="DBCExport.pas"/>
    160         <Caret Line="189" Column="1" TopLine="175"/>
     160        <Caret Line="193" Column="1" TopLine="179"/>
    161161      </Position2>
    162162      <Position3>
    163163        <Filename Value="DBCExport.pas"/>
    164         <Caret Line="190" Column="1" TopLine="176"/>
     164        <Caret Line="194" Column="1" TopLine="180"/>
    165165      </Position3>
    166166      <Position4>
    167167        <Filename Value="DBCExport.pas"/>
    168         <Caret Line="191" Column="1" TopLine="177"/>
     168        <Caret Line="195" Column="1" TopLine="181"/>
    169169      </Position4>
    170170      <Position5>
    171171        <Filename Value="DBCExport.pas"/>
    172         <Caret Line="192" Column="1" TopLine="178"/>
     172        <Caret Line="194" Column="64" TopLine="176"/>
    173173      </Position5>
    174174      <Position6>
    175175        <Filename Value="DBCExport.pas"/>
    176         <Caret Line="193" Column="1" TopLine="179"/>
     176        <Caret Line="190" Column="1" TopLine="177"/>
    177177      </Position6>
    178178      <Position7>
    179179        <Filename Value="DBCExport.pas"/>
    180         <Caret Line="194" Column="1" TopLine="180"/>
     180        <Caret Line="157" Column="1" TopLine="146"/>
    181181      </Position7>
    182182      <Position8>
    183183        <Filename Value="DBCExport.pas"/>
    184         <Caret Line="188" Column="1" TopLine="174"/>
     184        <Caret Line="156" Column="1" TopLine="142"/>
    185185      </Position8>
    186186      <Position9>
    187187        <Filename Value="DBCExport.pas"/>
    188         <Caret Line="83" Column="1" TopLine="69"/>
     188        <Caret Line="157" Column="1" TopLine="143"/>
    189189      </Position9>
    190190      <Position10>
    191191        <Filename Value="DBCExport.pas"/>
    192         <Caret Line="186" Column="20" TopLine="166"/>
     192        <Caret Line="158" Column="1" TopLine="144"/>
    193193      </Position10>
    194194      <Position11>
    195195        <Filename Value="DBCExport.pas"/>
    196         <Caret Line="83" Column="1" TopLine="69"/>
     196        <Caret Line="157" Column="1" TopLine="143"/>
    197197      </Position11>
    198198      <Position12>
    199199        <Filename Value="DBCExport.pas"/>
    200         <Caret Line="186" Column="19" TopLine="166"/>
     200        <Caret Line="208" Column="22" TopLine="184"/>
    201201      </Position12>
    202202      <Position13>
    203203        <Filename Value="DBCExport.pas"/>
    204         <Caret Line="83" Column="1" TopLine="69"/>
     204        <Caret Line="190" Column="1" TopLine="176"/>
    205205      </Position13>
    206206      <Position14>
    207207        <Filename Value="DBCExport.pas"/>
    208         <Caret Line="180" Column="1" TopLine="166"/>
     208        <Caret Line="193" Column="1" TopLine="184"/>
    209209      </Position14>
    210210      <Position15>
    211211        <Filename Value="DBCExport.pas"/>
    212         <Caret Line="186" Column="20" TopLine="174"/>
     212        <Caret Line="194" Column="1" TopLine="180"/>
    213213      </Position15>
    214214      <Position16>
    215215        <Filename Value="DBCExport.pas"/>
    216         <Caret Line="82" Column="1" TopLine="69"/>
     216        <Caret Line="195" Column="1" TopLine="181"/>
    217217      </Position16>
    218218      <Position17>
    219219        <Filename Value="DBCExport.pas"/>
    220         <Caret Line="188" Column="1" TopLine="166"/>
     220        <Caret Line="196" Column="1" TopLine="182"/>
    221221      </Position17>
    222222      <Position18>
    223223        <Filename Value="DBCExport.pas"/>
    224         <Caret Line="187" Column="73" TopLine="173"/>
     224        <Caret Line="199" Column="1" TopLine="185"/>
    225225      </Position18>
    226226      <Position19>
    227227        <Filename Value="DBCExport.pas"/>
    228         <Caret Line="188" Column="1" TopLine="174"/>
     228        <Caret Line="201" Column="1" TopLine="187"/>
    229229      </Position19>
    230230      <Position20>
    231231        <Filename Value="DBCExport.pas"/>
    232         <Caret Line="186" Column="20" TopLine="174"/>
     232        <Caret Line="202" Column="1" TopLine="188"/>
    233233      </Position20>
    234234      <Position21>
    235235        <Filename Value="DBCExport.pas"/>
    236         <Caret Line="188" Column="41" TopLine="173"/>
     236        <Caret Line="203" Column="1" TopLine="189"/>
    237237      </Position21>
    238238      <Position22>
    239239        <Filename Value="DBCExport.pas"/>
    240         <Caret Line="187" Column="1" TopLine="173"/>
     240        <Caret Line="204" Column="1" TopLine="190"/>
    241241      </Position22>
    242242      <Position23>
    243243        <Filename Value="DBCExport.pas"/>
    244         <Caret Line="188" Column="1" TopLine="174"/>
     244        <Caret Line="205" Column="1" TopLine="191"/>
    245245      </Position23>
    246246      <Position24>
    247         <Filename Value="DBCExport.pas"/>
    248         <Caret Line="189" Column="1" TopLine="175"/>
     247        <Filename Value="UDBC.pas"/>
     248        <Caret Line="125" Column="1" TopLine="111"/>
    249249      </Position24>
    250250      <Position25>
    251         <Filename Value="DBCExport.pas"/>
    252         <Caret Line="188" Column="32" TopLine="176"/>
     251        <Filename Value="UDBC.pas"/>
     252        <Caret Line="126" Column="1" TopLine="112"/>
    253253      </Position25>
    254254      <Position26>
    255         <Filename Value="DBCExport.pas"/>
    256         <Caret Line="190" Column="28" TopLine="176"/>
     255        <Filename Value="UDBC.pas"/>
     256        <Caret Line="127" Column="1" TopLine="113"/>
    257257      </Position26>
    258258      <Position27>
    259         <Filename Value="DBCExport.pas"/>
    260         <Caret Line="187" Column="1" TopLine="173"/>
     259        <Filename Value="UDBC.pas"/>
     260        <Caret Line="128" Column="1" TopLine="114"/>
    261261      </Position27>
    262262      <Position28>
    263         <Filename Value="DBCExport.pas"/>
    264         <Caret Line="188" Column="1" TopLine="174"/>
     263        <Filename Value="UDBC.pas"/>
     264        <Caret Line="130" Column="1" TopLine="116"/>
    265265      </Position28>
    266266      <Position29>
    267267        <Filename Value="DBCExport.pas"/>
    268         <Caret Line="189" Column="1" TopLine="175"/>
     268        <Caret Line="206" Column="1" TopLine="192"/>
    269269      </Position29>
    270270      <Position30>
    271271        <Filename Value="DBCExport.pas"/>
    272         <Caret Line="190" Column="1" TopLine="176"/>
     272        <Caret Line="207" Column="1" TopLine="193"/>
    273273      </Position30>
    274274    </JumpHistory>
     
    304304  </CompilerOptions>
    305305  <Debugging>
     306    <BreakPoints Count="2">
     307      <Item1>
     308        <Source Value="DBCExport.pas"/>
     309        <Line Value="190"/>
     310      </Item1>
     311      <Item2>
     312        <Source Value="DBCExport.pas"/>
     313        <Line Value="199"/>
     314      </Item2>
     315    </BreakPoints>
     316    <Watches Count="2">
     317      <Item1>
     318        <Expression Value="IndexTable"/>
     319      </Item1>
     320      <Item2>
     321        <Expression Value="entry"/>
     322      </Item2>
     323    </Watches>
    306324    <Exceptions Count="3">
    307325      <Item1>
  • tools/dbc_export/DBCExport.pas

    r340 r341  
    2424    NewDBCFileName: string;
    2525    ColumnTypeDefinition: string;
     26    LastIndexStringColumns: integer;
     27    IndexTable: array of integer;
    2628    SQLquery: string;
    2729    DisplayData: Boolean;
     
    3335    procedure SaveDBC;
    3436    procedure ReplaceText;
     37    procedure CreateIndexTable(var DbRows: TDbRows);
    3538    function GetIDbyEntry(entry: integer; var DBRows: TDBRows): integer;
    3639  end;
     
    120123  WriteLn('  -c --coltypedef  DBC column type definition string (u - uint32, s - string)');
    121124  WriteLn('  -d --display     Display DBC data');
    122   WriteLn('  -q --sql_query  SQL select when entry is ID first column in dbc file and text0,text1... is texts columns');
    123   // SELECT T.entry as entry,T.Text as text0 FROM (SELECT * FROM gametips WHERE (Complete = 1) AND ((Language = 1)) AND (User IN (459,670,602,462,1,400,638,592,624,610,769,331,131,704,2,499,641,660,578,337,304,277,208,613,768,754,590,606,26,618,739,503,601,607,585,596,765,320,547,687)) AND VersionStart <= 9947 AND VersionEnd >= 9947) AS T GROUP BY T.entry
     125  WriteLn('  -q --sql_query  SQL select when entry is ID first column in dbc file and text1,text2... is texts columns');
     126  // SELECT T.entry as entry,T.Text as text1 FROM (SELECT * FROM gametips WHERE (Complete = 1) AND ((Language = 1)) AND (User IN (459,670,602,462,1,400,638,592,624,610,769,331,131,704,2,499,641,660,578,337,304,277,208,613,768,754,590,606,26,618,739,503,601,607,585,596,765,320,547,687)) AND VersionStart <= 9947 AND VersionEnd >= 9947) AS T GROUP BY T.entry
    124127end;
    125128
     
    153156      // Load strings for string columns
    154157      for I := 1 to Length(ColumnTypeDefinition) do
    155         if ColumnTypeDefinition[I] = 's' then
     158        if ColumnTypeDefinition[I] = 's' then begin
    156159          LoadColumnStrings(I - 1);
     160          LastIndexStringColumns:=I;
     161        end;
     162
    157163
    158164    end else WriteLn('File ' + DBCFileName + ' not exists.');
     
    174180  DBRows : TDbRows;
    175181  Text: String;
    176   X, Y, I: Integer;
     182  X, Y, I,entry: Integer;
    177183  IndexRowData: Integer;
    178184begin
     
    182188      DBRows := Database.Query(SQLquery);
    183189
     190      CreateIndexTable(DBRows);
     191
    184192
    185193      for Y := 0 to Length(DBC.Cells) - 1 do begin
    186         if (Y = 129) then
    187                IndexRowData:= GetIDbyEntry(Cells[Y,0],DBRows);
    188         IndexRowData:= GetIDbyEntry(Cells[Y,0],DBRows);
    189         I := 0;
    190         if (IndexRowData <> -1) then begin
    191           for X := 0 to Length(ColumnTypeDefinition)-1 do begin
    192             if ColumnTypeDefinition[X+1] = 's' then begin
    193               Text:=DBRows.Data[IndexRowData].Values['text'+IntToStr(I)];
    194               SetString(Y,X,Text);
     194        entry :=Cells[Y,0];
     195        if (Length(IndexTable) > entry) then
     196           IndexRowData:= IndexTable[entry]
     197        else IndexRowData:= 0;
     198
     199         I := 1;
     200
     201        if (IndexRowData <> 0) then begin
     202          for X := 1 to Length(ColumnTypeDefinition) do begin
     203            if ColumnTypeDefinition[X] = 's' then begin
     204              Text:=DBRows.Data[IndexRowData-1].Values['text'+IntToStr(I)];
     205              SetString(Y,X-1,Text);
    195206              I:=I+1;
     207              if (LastIndexStringColumns = X) then
     208                Break;
    196209            end;
    197210          end;
    198           DBRows.Delete(IndexRowData);
    199211        end;
     212
    200213      end;
    201214
     
    203216
    204217    end;
     218  end;
     219end;
     220
     221//create table index = entry, value = Index-1 DBRows, notfound = 0
     222procedure TDBCExport.CreateIndexTable(var DbRows: TDbRows);
     223var
     224 i: integer;
     225 Count,entry: integer;
     226begin
     227  try
     228     Count:=DBRows.Count;
     229     for i:=1 to Count do begin
     230       entry:=StrToInt(DBRows.Data[i-1].Values['entry']);
     231
     232       if (i =127) then
     233         SetLength(IndexTable,entry+1);
     234
     235       if (Length(IndexTable)-1 < entry) then
     236         SetLength(IndexTable,entry+1);
     237
     238
     239       IndexTable[entry]:=i;
     240
     241    end;
     242  except
    205243  end;
    206244end;
Note: See TracChangeset for help on using the changeset viewer.