Ignore:
Timestamp:
Apr 3, 2010, 9:31:48 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Ve vytvářeném DBC souboru nebyla vůbec přepočtena nová velikost bloku řetězců.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/dbc_export/UDBC.pas

    r348 r414  
    8585procedure TDBC.SaveToFile(FileName: string);
    8686var
    87   Signature: Cardinal;
    88   Row, Col: Integer;
    89   Offset: Integer;
     87  Row, Col: Cardinal;
     88  Offset: Cardinal;
    9089  StringList: array of string;
    9190begin
     
    103102    Offset := 1;
    104103    // Write cells
    105     for Row := 0 to RecordCount - 1 do
     104    for Row := 0 to RecordCount - 1 do begin
    106105      for Col := 0 to FieldCount - 1 do begin
    107106        if VarIsStr(Cells[Row, Col]) then begin
     107          //System.Write(IntToStr(Offset) + ': "' + Cells[Row, Col] + '", ');
    108108          WriteDWord(Offset);
    109109          Offset := Offset + Length(Cells[Row, Col]) + 1;
    110110          SetLength(StringList, Length(StringList) + 1);
    111111          StringList[High(StringList)] := Cells[Row, Col];
    112         end else WriteDWord(Cells[Row, Col]);
     112        end else begin
     113          //System.Write(IntToStr(Cells[Row, Col]) + ', ');
     114          WriteDWord(Cells[Row, Col]);
     115        end;
    113116      end;
     117      //WriteLn;
     118    end;
    114119
    115120    // Write strings
     121    Offset := 1;
    116122    WriteByte(0);
    117123    for Row := 0 to Length(StringList) - 1 do begin
     124      //WriteLn('Id: ' + IntToStr(Row) + ', Offset: ' + IntToStr(Offset) + ', "' + StringList[Row] + '"');
    118125      for Col := 1 to Length(StringList[Row]) do
    119126        WriteByte(Ord(StringList[Row][Col]));
    120         WriteByte(0);
     127      WriteByte(0);
     128      Offset := Offset + Length(StringList[Row]) + 1;
    121129    end;
     130
     131    // Update string block size
     132    StringBlockSize := Offset;
     133    Seek(16, soFromBeginning);
     134    WriteDWord(StringBlockSize);
    122135  end;
    123136end;
Note: See TracChangeset for help on using the changeset viewer.