Changeset 337 for tools


Ignore:
Timestamp:
Feb 27, 2010, 10:43:58 AM (14 years ago)
Author:
george
Message:
  • Přidáno: Parametr pro určení typů sloupců a následné načtení textů pro řetězcové sloupce.
Location:
tools/dbc_export
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/dbc_export/DBCExport.lpi

    r336 r337  
    3535        <IsPartOfProject Value="True"/>
    3636        <UnitName Value="DBCExport"/>
    37         <CursorPos X="42" Y="50"/>
    38         <TopLine Value="38"/>
     37        <CursorPos X="16" Y="68"/>
     38        <TopLine Value="98"/>
    3939        <EditorIndex Value="0"/>
    4040        <UsageCount Value="30"/>
     
    125125        <IsPartOfProject Value="True"/>
    126126        <UnitName Value="UDBC"/>
    127         <CursorPos X="3" Y="19"/>
    128         <TopLine Value="3"/>
     127        <CursorPos X="21" Y="54"/>
     128        <TopLine Value="60"/>
    129129        <EditorIndex Value="2"/>
    130130        <UsageCount Value="21"/>
     
    148148        <TopLine Value="47"/>
    149149        <EditorIndex Value="1"/>
    150         <UsageCount Value="10"/>
     150        <UsageCount Value="11"/>
    151151        <Loaded Value="True"/>
    152152      </Unit14>
    153153    </Units>
    154     <JumpHistory Count="17" HistoryIndex="16">
     154    <JumpHistory Count="22" HistoryIndex="21">
    155155      <Position1>
    156156        <Filename Value="UDBC.pas"/>
     
    221221        <Caret Line="50" Column="37" TopLine="37"/>
    222222      </Position17>
     223      <Position18>
     224        <Filename Value="DBCExport.pas"/>
     225        <Caret Line="112" Column="13" TopLine="100"/>
     226      </Position18>
     227      <Position19>
     228        <Filename Value="DBCExport.pas"/>
     229        <Caret Line="113" Column="5" TopLine="107"/>
     230      </Position19>
     231      <Position20>
     232        <Filename Value="DBCExport.pas"/>
     233        <Caret Line="60" Column="61" TopLine="44"/>
     234      </Position20>
     235      <Position21>
     236        <Filename Value="DBCExport.pas"/>
     237        <Caret Line="123" Column="36" TopLine="107"/>
     238      </Position21>
     239      <Position22>
     240        <Filename Value="DBCExport.pas"/>
     241        <Caret Line="34" Column="3" TopLine="18"/>
     242      </Position22>
    223243    </JumpHistory>
    224244  </ProjectOptions>
  • tools/dbc_export/DBCExport.pas

    r336 r337  
    2121    DBCFileName: string;
    2222    NewDBCFileName: string;
     23    ColumnTypeDefinition: string;
    2324    constructor Create(TheOwner: TComponent); override;
    2425    destructor Destroy; override;
     
    3031
    3132procedure TDBCExport.DoRun;
    32 var
    33   ErrorMsg: String;
    3433begin
    35   // Quick check parameters
    36   //ErrorMsg := CheckOptions('h', 'help');
    37   //if ErrorMsg <> '' then begin
    38   //  ShowException(Exception.Create(ErrorMsg));
    39   //  Halt;
    40   //end;
    41 
    4234  // Parse parameters
    4335  if HasOption('h', 'help') then begin
     
    5547  if HasOption('n', 'newfile') then begin
    5648    NewDBCFileName := GetOptionValue('n', 'newfile');
     49  end;
     50  if HasOption('c', 'coltypedef') then begin
     51    ColumnTypeDefinition := GetOptionValue('c', 'coltypedef');
    5752  end;
    5853
     
    9388begin
    9489  WriteLn('Usage: ', ExtractFileName(ExeName), ' [options]');
    95   WriteLn('  -h --help      Show this help');
    96   WriteLn('  -u --user      Database user name');
    97   WriteLn('  -p --password  Database password name');
    98   WriteLn('  -s --schema    Database schema name');
    99   WriteLn('  -t --host      Database host name');
    100   WriteLn('  -f --file      Source DBC file name');
    101   WriteLn('  -n --newfile   New created DBC file name');
     90  WriteLn('  -h --help        Show this help');
     91  WriteLn('  -u --user        Database user name');
     92  WriteLn('  -p --password    Database password name');
     93  WriteLn('  -s --schema      Database schema name');
     94  WriteLn('  -t --host        Database host name');
     95  WriteLn('  -f --file        Source DBC file name');
     96  WriteLn('  -n --newfile     New created DBC file name');
     97  WriteLn('  -c --coltypedef  DBC column type definition string');
     98  WriteLn('                     u - uint32, s - string');
    10299end;
    103100
    104101procedure TDBCExport.ShowDBC;
    105102var
    106   X, Y: Integer;
    107   Text: string;
     103  //X, Y: Integer;
     104  //Text: string;
     105  I: Integer;
    108106begin
    109107  DBC := TDBC.Create;
     
    111109    if FileExists(DBCFileName) then begin
    112110      LoadFromFile(DBCFileName);
    113       //LoadColumnStrings(1);
    114       //LoadColumnStrings(127);
     111
     112      // Load strings for string columns
     113      for I := 1 to Length(ColumnTypeDefinition) do
     114        if ColumnTypeDefinition[I] = 's' then
     115          LoadColumnStrings(I - 1);
     116
    115117      (*for Y := 0 to Length(Cells) - 1 do begin
    116118        Text := '';
  • tools/dbc_export/UDBC.pas

    r335 r337  
    5252    StringBlockSize := ReadDWord;
    5353
    54     SetLength(Cells,  RecordCount, FieldCount);
     54    SetLength(Cells, RecordCount, FieldCount);
    5555    for Row := 0 to RecordCount - 1 do
    5656      for Col := 0 to FieldCount - 1 do begin
Note: See TracChangeset for help on using the changeset viewer.