procedure TfrmMain.DispDir;
var
root,tmp: IXMLNode;
ListItem: TListItem;
i:integer;
fSize :
string;
function FileImgIndex(FileName:
String):integer;
var
Ext:
String;
begin
Result := 2;
Ext:= LowerCase(ExtractFileExt(FileName));
if Ext='
.3gp'
then Result := 3
else
if Ext='
.bmp'
then Result := 4
else
if Ext='
.bmx'
then Result := 5
else
if Ext='
.css'
then Result := 6
else
if Ext='
.hfi'
then Result := 7
else
if Ext='
.gif'
then Result := 8
else
if Ext='
.html'
then Result := 9
else
if Ext='
.imy'
then Result := 10
else
if Ext='
.jpg'
then Result := 11
else
if Ext='
.mid'
then Result := 12
else
if Ext='
.mmc'
then Result := 13
else
if Ext='
.mmf'
then Result := 14
else
if Ext='
.mp3'
then Result := 15
else
if Ext='
.mp4'
then Result := 16
else
if Ext='
.png'
then Result := 17
else
if Ext='
.srt'
then Result := 18
else
if Ext='
.svg'
then Result := 19
else
if Ext='
.tiff'
then Result := 20
else
if Ext='
.vmg'
then Result := 21
else
if Ext='
.wav'
then Result := 22
else
if Ext='
.wbmp'
then Result := 23
else
if Ext='
.xhtml'
then Result := 24
else
if Ext='
.xls'
then Result := 25
else
if Ext='
.der'
then Result := 26
else
if Ext='
.doc'
then Result := 27
else
if Ext='
.dat'
then Result := 28
else
if Ext='
.jar'
then Result := 29
else
if Ext='
.pdf'
then Result := 30
else
if Ext='
.txt'
then Result := 31
else
if Ext='
.jad'
then Result := 32;
end;
function FrmTimeStr(t:
string):
string;
begin
Result := Copy(t,1,4)+'
-'+Copy(t,5,2)+'
-'+Copy(t,6,2)+'
'+
Copy(t,10,2)+'
:'+Copy(t,12,2)+'
:'+Copy(t,14,2);
end;
begin
// XML.XML.Text := Obex_Dir;
XML.XML.Text := HTMLContent (Obex_Dir);
ListView.Items.Clear;
with ListView.Items.Add
do
begin
ImageIndex := 0;
Caption := '
..';
SubItems.Add('
<DIR>');
SubItems.Add('
');
//
SubItems.Add('
');
end;
XML.Active := true;
root :=
XML.DocumentElement;
for i:=0
to root.ChildNodes.Count-1
do
begin
tmp:=root.ChildNodes.Nodes[i];
ListItem := ListView.Items.Add;
ListItem.Caption := tmp.Attributes['
name'];
if tmp.NodeName ='
folder'
then
begin
ListItem.ImageIndex := 1;
ListItem.SubItems.Add('
<DIR>');
ListItem.SubItems.Add('
');
end;
if tmp.NodeName ='
file'
then
begin
ListItem.ImageIndex := FileImgIndex(ListItem.Caption);
fSize := tmp.Attributes['
size'];
fSize := StringOfChar('
',7-Length(fSize))+fSize;
ListItem.SubItems.Add(fSize);
ListItem.SubItems.Add(ExtractFileExt(ListItem.Caption)+'
Datei');
end;
ListItem.SubItems.Add(FrmTimeStr(tmp.Attributes['
modified']));
end;
XML.Active := false;
Label2.Caption :=ProductID;
Label1.Caption := ProductID +'
:/';
for I := 0
to PathList.Count - 1
do // Iterate
begin
Label1.Caption := Label1.Caption + '
/'+ PathList.Strings[I];
end;
end;