- Timestamp:
- Feb 27, 2010, 10:32:23 AM (15 years ago)
- Location:
- tools/dbc_export
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/dbc_export/DBCExport.lpi
r335 r336 30 30 </local> 31 31 </RunParams> 32 <Units Count="1 4">32 <Units Count="15"> 33 33 <Unit0> 34 34 <Filename Value="DBCExport.pas"/> 35 35 <IsPartOfProject Value="True"/> 36 36 <UnitName Value="DBCExport"/> 37 <CursorPos X="4 4" Y="22"/>38 <TopLine Value=" 1"/>37 <CursorPos X="42" Y="50"/> 38 <TopLine Value="38"/> 39 39 <EditorIndex Value="0"/> 40 <UsageCount Value=" 29"/>40 <UsageCount Value="30"/> 41 41 <Loaded Value="True"/> 42 42 <SyntaxHighlighter Value="Delphi"/> … … 116 116 <CursorPos X="1" Y="1"/> 117 117 <TopLine Value="71"/> 118 <EditorIndex Value=" 3"/>119 <UsageCount Value="2 0"/>118 <EditorIndex Value="4"/> 119 <UsageCount Value="21"/> 120 120 <Loaded Value="True"/> 121 121 <SyntaxHighlighter Value="Delphi"/> … … 125 125 <IsPartOfProject Value="True"/> 126 126 <UnitName Value="UDBC"/> 127 <CursorPos X="3 2" Y="92"/>128 <TopLine Value=" 20"/>129 <EditorIndex Value=" 1"/>130 <UsageCount Value="2 0"/>127 <CursorPos X="3" Y="19"/> 128 <TopLine Value="3"/> 129 <EditorIndex Value="2"/> 130 <UsageCount Value="21"/> 131 131 <Loaded Value="True"/> 132 132 <SyntaxHighlighter Value="Delphi"/> … … 137 137 <CursorPos X="1" Y="8"/> 138 138 <TopLine Value="1"/> 139 <EditorIndex Value=" 2"/>140 <UsageCount Value="2 0"/>139 <EditorIndex Value="3"/> 140 <UsageCount Value="21"/> 141 141 <Loaded Value="True"/> 142 142 <SyntaxHighlighter Value="None"/> 143 143 </Unit13> 144 <Unit14> 145 <Filename Value="/usr/share/fpcsrc/packages/fcl-base/src/custapp.pp"/> 146 <UnitName Value="CustApp"/> 147 <CursorPos X="1" Y="63"/> 148 <TopLine Value="47"/> 149 <EditorIndex Value="1"/> 150 <UsageCount Value="10"/> 151 <Loaded Value="True"/> 152 </Unit14> 144 153 </Units> 145 <JumpHistory Count=" 6" HistoryIndex="5">154 <JumpHistory Count="17" HistoryIndex="16"> 146 155 <Position1> 147 156 <Filename Value="UDBC.pas"/> … … 168 177 <Caret Line="8" Column="29" TopLine="1"/> 169 178 </Position6> 179 <Position7> 180 <Filename Value="DBCExport.pas"/> 181 <Caret Line="15" Column="38" TopLine="8"/> 182 </Position7> 183 <Position8> 184 <Filename Value="DBCExport.pas"/> 185 <Caret Line="46" Column="12" TopLine="35"/> 186 </Position8> 187 <Position9> 188 <Filename Value="DBCExport.pas"/> 189 <Caret Line="64" Column="1" TopLine="46"/> 190 </Position9> 191 <Position10> 192 <Filename Value="DBCExport.pas"/> 193 <Caret Line="62" Column="52" TopLine="46"/> 194 </Position10> 195 <Position11> 196 <Filename Value="DBCExport.pas"/> 197 <Caret Line="103" Column="33" TopLine="87"/> 198 </Position11> 199 <Position12> 200 <Filename Value="DBCExport.pas"/> 201 <Caret Line="102" Column="10" TopLine="81"/> 202 </Position12> 203 <Position13> 204 <Filename Value="DBCExport.pas"/> 205 <Caret Line="19" Column="13" TopLine="3"/> 206 </Position13> 207 <Position14> 208 <Filename Value="DBCExport.pas"/> 209 <Caret Line="103" Column="33" TopLine="87"/> 210 </Position14> 211 <Position15> 212 <Filename Value="DBCExport.pas"/> 213 <Caret Line="47" Column="31" TopLine="27"/> 214 </Position15> 215 <Position16> 216 <Filename Value="DBCExport.pas"/> 217 <Caret Line="35" Column="22" TopLine="27"/> 218 </Position16> 219 <Position17> 220 <Filename Value="DBCExport.pas"/> 221 <Caret Line="50" Column="37" TopLine="37"/> 222 </Position17> 170 223 </JumpHistory> 171 224 </ProjectOptions> … … 191 244 <VerifyObjMethodCallValidity Value="True"/> 192 245 </CodeGeneration> 193 <Linking>194 <LinkSmart Value="True"/>195 </Linking>196 246 <Other> 197 247 <Verbosity> -
tools/dbc_export/DBCExport.pas
r335 r336 19 19 DBC: TDBC; 20 20 Database: TSqlDatabase; 21 DBCFileName: string; 22 NewDBCFileName: string; 21 23 constructor Create(TheOwner: TComponent); override; 22 24 destructor Destroy; override; … … 32 34 begin 33 35 // Quick check parameters 34 ErrorMsg := CheckOptions('h', 'help');35 if ErrorMsg <> '' then begin36 ShowException(Exception.Create(ErrorMsg));37 Halt;38 end;36 //ErrorMsg := CheckOptions('h', 'help'); 37 //if ErrorMsg <> '' then begin 38 // ShowException(Exception.Create(ErrorMsg)); 39 // Halt; 40 //end; 39 41 40 42 // Parse parameters … … 43 45 Halt; 44 46 end; 47 if HasOption('f', 'file') then begin 48 DBCFileName := GetOptionValue('f', 'file'); 49 NewDBCFileName := Copy(DBCFileName, 1, Length(DBCFileName) - 50 Length(ExtractFileExt(DBCFileName))) + '-2.dbc'; 51 end else begin 52 WriteLn('Source DBC file not specified.'); 53 Halt; 54 end; 55 if HasOption('n', 'newfile') then begin 56 NewDBCFileName := GetOptionValue('n', 'newfile'); 57 end; 58 59 if HasOption('s', 'schema') then begin 60 Database.Database := GetOptionValue('s', 'schema'); 61 end else Database.Database := 'wowpreklad'; 62 if HasOption('u', 'user') then begin 63 Database.UserName := GetOptionValue('u', 'user'); 64 end else Database.UserName := 'root'; 65 if HasOption('p', 'password') then begin 66 Database.Password := GetOptionValue('p', 'password'); 67 end else Database.Password := ''; 68 if HasOption('t', 'host') then begin 69 Database.Hostname := GetOptionValue('t', 'host'); 70 end else Database.Hostname := 'localhost'; 71 72 45 73 ShowDBC; 46 74 … … 53 81 inherited Create(TheOwner); 54 82 StopOnException := True; 83 Database := TSqlDatabase.Create;; 55 84 end; 56 85 57 86 destructor TDBCExport.Destroy; 58 87 begin 88 Database.Destroy; 59 89 inherited Destroy; 60 90 end; … … 62 92 procedure TDBCExport.WriteHelp; 63 93 begin 64 { add your help code here } 65 WriteLn('Usage: ', ExeName, ' -h'); 94 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'); 66 102 end; 67 103 … … 73 109 DBC := TDBC.Create; 74 110 with DBC do begin 75 LoadFromFile('Spell.dbc'); 76 //LoadColumnStrings(1); 77 //LoadColumnStrings(127); 78 (*for Y := 0 to Length(Cells) - 1 do begin 79 Text := ''; 80 for X := 0 to Length(Cells[Y]) - 1 do 81 if VarIsStr(Cells[Y, X]) then Text := Text + Cells[Y, X] + ', ' 82 else Text := Text + IntToStr(Cells[Y, X]) + ', '; 83 WriteLn(Text); 84 end; 85 *) 86 WriteLn('Save'); 87 SaveToFile('Spell2.dbc'); 111 if FileExists(DBCFileName) then begin 112 LoadFromFile(DBCFileName); 113 //LoadColumnStrings(1); 114 //LoadColumnStrings(127); 115 (*for Y := 0 to Length(Cells) - 1 do begin 116 Text := ''; 117 for X := 0 to Length(Cells[Y]) - 1 do 118 if VarIsStr(Cells[Y, X]) then Text := Text + Cells[Y, X] + ', ' 119 else Text := Text + IntToStr(Cells[Y, X]) + ', '; 120 WriteLn(Text); 121 end; 122 *) 123 WriteLn('Save'); 124 SaveToFile(NewDBCFileName); 125 end else WriteLn('File ' + DBCFileName + ' not exists.'); 88 126 Free; 89 127 end;
Note:
See TracChangeset
for help on using the changeset viewer.