101 |
|
oldcon: String; |
102 |
|
begin |
103 |
|
oldcon := combo_connection.Items.Strings[combo_connection.ItemIndex]; |
104 |
+ |
combo_connection.ItemIndex := -1; |
105 |
|
combo_connection.Items.Clear; |
106 |
< |
for i := 0 to High(DataConnections) do |
106 |
> |
if Length(DataConnections) > 0 then |
107 |
|
begin |
108 |
< |
level := DataConnections[i].LevelInfo.LevelNumber; |
109 |
< |
fn := ExtractFileName(DataConnections[i].FileName); |
110 |
< |
if DataConnections[i].Backend = ODB_Dat then |
111 |
< |
datatype := 'ONI-.dat: ' |
112 |
< |
else if DataConnections[i].Backend = ODB_ADB then |
113 |
< |
datatype := 'OUP-DB: ' |
114 |
< |
else |
115 |
< |
datatype := 'Unknown: '; |
116 |
< |
boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')'; |
117 |
< |
combo_connection.Items.Add(boxstring); |
118 |
< |
if oldcon = boxstring then |
119 |
< |
combo_connection.ItemIndex := combo_connection.Items.Count - 1; |
108 |
> |
for i := 0 to High(DataConnections) do |
109 |
> |
begin |
110 |
> |
level := DataConnections[i].LevelInfo.LevelNumber; |
111 |
> |
fn := ExtractFileName(DataConnections[i].FileName); |
112 |
> |
if DataConnections[i].Backend = ODB_Dat then |
113 |
> |
datatype := 'ONI-.dat: ' |
114 |
> |
else if DataConnections[i].Backend = ODB_ADB then |
115 |
> |
datatype := 'OUP-DB: ' |
116 |
> |
else |
117 |
> |
datatype := 'Unknown: '; |
118 |
> |
boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')'; |
119 |
> |
combo_connection.Items.Add(boxstring); |
120 |
> |
if oldcon = boxstring then |
121 |
> |
combo_connection.ItemIndex := combo_connection.Items.Count - 1; |
122 |
> |
end; |
123 |
> |
if combo_connection.ItemIndex = -1 then |
124 |
> |
begin |
125 |
> |
combo_connection.ItemIndex := 0; |
126 |
> |
combo_connectionChange(Self); |
127 |
> |
end; |
128 |
> |
end |
129 |
> |
else |
130 |
> |
begin |
131 |
> |
FConnection := nil; |
132 |
> |
filelist.Items.Clear; |
133 |
> |
combo_extension.Items.Clear; |
134 |
> |
combo_connectionChange(Self); |
135 |
> |
FSelectedFile := GetEmptyFileInfo; |
136 |
> |
if Assigned(FOnNewFileSelected) then |
137 |
> |
FOnNewFileSelected(FSelectedFile); |
138 |
|
end; |
139 |
|
end; |
140 |
|
|
145 |
|
level: Integer; |
146 |
|
begin |
147 |
|
combo_connection.Items.Clear; |
148 |
< |
for i := 0 to High(DataConnections) do |
148 |
> |
if Length(DataConnections) > 0 then |
149 |
|
begin |
150 |
< |
level := DataConnections[i].LevelInfo.LevelNumber; |
151 |
< |
fn := ExtractFileName(DataConnections[i].FileName); |
152 |
< |
if DataConnections[i].Backend = ODB_Dat then |
153 |
< |
datatype := 'ONI-.dat: ' |
154 |
< |
else if DataConnections[i].Backend = ODB_ADB then |
155 |
< |
datatype := 'OUP-DB: ' |
156 |
< |
else |
157 |
< |
datatype := 'Unknown: '; |
158 |
< |
combo_connection.Items.Add(datatype + fn + ' (Level: ' + IntToStr(level) + ')'); |
159 |
< |
end; |
160 |
< |
FConnection := DataConnections[0]; |
161 |
< |
combo_connection.ItemIndex := 0; |
162 |
< |
combo_connectionChange(Self); |
150 |
> |
for i := 0 to High(DataConnections) do |
151 |
> |
begin |
152 |
> |
level := DataConnections[i].LevelInfo.LevelNumber; |
153 |
> |
fn := ExtractFileName(DataConnections[i].FileName); |
154 |
> |
if DataConnections[i].Backend = ODB_Dat then |
155 |
> |
datatype := 'ONI-.dat: ' |
156 |
> |
else if DataConnections[i].Backend = ODB_ADB then |
157 |
> |
datatype := 'OUP-DB: ' |
158 |
> |
else |
159 |
> |
datatype := 'Unknown: '; |
160 |
> |
combo_connection.Items.Add(datatype + fn + ' (Level: ' + IntToStr(level) + ')'); |
161 |
> |
end; |
162 |
> |
FConnection := DataConnections[0]; |
163 |
> |
combo_connection.ItemIndex := 0; |
164 |
> |
combo_connectionChange(Self); |
165 |
> |
end |
166 |
> |
else |
167 |
> |
begin |
168 |
> |
FConnection := nil; |
169 |
> |
filelist.Items.Clear; |
170 |
> |
combo_extension.Items.Clear; |
171 |
> |
combo_connectionChange(Self); |
172 |
> |
end; |
173 |
|
end; |
174 |
|
|
175 |
|
procedure TForm_ToolTemplate.RecreateExtList; |
178 |
|
exts: TStringArray; |
179 |
|
begin |
180 |
|
combo_extension.Items.Clear; |
181 |
< |
combo_extension.Items.Add('_All files_ (' + |
182 |
< |
IntToStr(FConnection.GetFilesCount) + ')'); |
183 |
< |
exts := FConnection.GetExtensionsList; |
184 |
< |
for i := 0 to High(exts) do |
185 |
< |
if Length(FAllowedExts) > 0 then |
186 |
< |
begin |
187 |
< |
if Pos(MidStr(exts[i],1,4), FAllowedExts) > 0 then |
181 |
> |
if FConnection <> nil then |
182 |
> |
begin |
183 |
> |
combo_extension.Items.Add('_All files_ (' + |
184 |
> |
IntToStr(FConnection.GetFilesCount) + ')'); |
185 |
> |
exts := FConnection.GetExtensionsList; |
186 |
> |
for i := 0 to High(exts) do |
187 |
> |
if Length(FAllowedExts) > 0 then |
188 |
|
begin |
189 |
+ |
if Pos(MidStr(exts[i],1,4), FAllowedExts) > 0 then |
190 |
+ |
begin |
191 |
+ |
combo_extension.Items.Add(exts[i]); |
192 |
+ |
end; |
193 |
+ |
end else |
194 |
|
combo_extension.Items.Add(exts[i]); |
195 |
< |
end; |
196 |
< |
end else |
197 |
< |
combo_extension.Items.Add(exts[i]); |
164 |
< |
combo_extension.ItemIndex := 0; |
165 |
< |
combo_extensionClick(Self); |
195 |
> |
combo_extension.ItemIndex := 0; |
196 |
> |
combo_extensionClick(Self); |
197 |
> |
end; |
198 |
|
end; |
199 |
|
|
200 |
|
|
208 |
|
files: TStringArray; |
209 |
|
i: LongWord; |
210 |
|
begin |
211 |
< |
Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4); |
212 |
< |
no_zero_bytes := not check_zerobyte.Checked; |
213 |
< |
pattern := ''; |
214 |
< |
if check_filtername.Checked then |
215 |
< |
pattern := edit_filtername.Text; |
216 |
< |
if Extension = '_All' then |
217 |
< |
if Length(FAllowedExts) > 0 then |
218 |
< |
Extension := FAllowedExts |
219 |
< |
else |
220 |
< |
Extension := ''; |
221 |
< |
|
222 |
< |
files := FConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy); |
223 |
< |
|
224 |
< |
filelist.Visible := False; |
225 |
< |
filelist.Items.Clear; |
226 |
< |
if Length(files) > 0 then |
227 |
< |
for i := 0 to High(files) do |
228 |
< |
filelist.Items.Add(files[i]); |
229 |
< |
filelist.Visible := True; |
211 |
> |
if FConnection <> nil then |
212 |
> |
begin |
213 |
> |
Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4); |
214 |
> |
no_zero_bytes := not check_zerobyte.Checked; |
215 |
> |
pattern := ''; |
216 |
> |
if check_filtername.Checked then |
217 |
> |
pattern := edit_filtername.Text; |
218 |
> |
if Extension = '_All' then |
219 |
> |
if Length(FAllowedExts) > 0 then |
220 |
> |
Extension := FAllowedExts |
221 |
> |
else |
222 |
> |
Extension := ''; |
223 |
> |
|
224 |
> |
files := FConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy); |
225 |
> |
|
226 |
> |
filelist.Visible := False; |
227 |
> |
filelist.Items.Clear; |
228 |
> |
if Length(files) > 0 then |
229 |
> |
for i := 0 to High(files) do |
230 |
> |
filelist.Items.Add(files[i]); |
231 |
> |
filelist.Visible := True; |
232 |
> |
end; |
233 |
|
end; |
234 |
|
|
235 |
|
|
330 |
|
begin |
331 |
|
inherited; |
332 |
|
RecreateList; |
333 |
< |
FConnection := nil; |
299 |
< |
FSelectedFile.ID := -1; |
300 |
< |
FSelectedFile.FileName := ''; |
301 |
< |
FSelectedFile.FileNameHex := ''; |
333 |
> |
FSelectedFile := GetEmptyFileInfo; |
334 |
|
if Length(ToolList) > 0 then |
335 |
|
begin |
336 |
|
for i := 0 to High(ToolList) do |