Einzelnen Beitrag anzeigen

Gehstock

Registriert seit: 28. Jan 2006
Ort: Görlitz / Sachsen
489 Beiträge
 
Delphi 2007 Professional
 
#6

Re: Sonderzeichen anzeigen lassen

  Alt 3. Okt 2006, 11:29
Delphi-Quellcode:

 function HTMLContent(const S: string): string;
  begin
    if s = 'then begin
    result := '';
    exit; end;
    Result := StringReplace(s, '&', '&', [rfreplaceall]);
// Result := StringReplace(result, '"', '"', [rfreplaceall]);
// Result := StringReplace(result, '<', '&lt;', [rfreplaceall]);
// Result := StringReplace(result, '>', '&gt;', [rfreplaceall]);
// Result := StringReplace(result, '''', '&auml' [rfreplaceall]);
// Result := StringReplace(result, 'ä', '&auml;', [rfreplaceall]); // OEM
// Result := StringReplace(result, 'ö', '&ouml;', [rfreplaceall]);
// Result := StringReplace(result, 'ü', '&uuml;', [rfreplaceall]);
// Result := StringReplace(result, 'Ä', '&Auml;', [rfreplaceall]);
// Result := StringReplace(result, 'Ö', '&Ouml;', [rfreplaceall]);
// Result := StringReplace(result, 'Ü', '&Uuml;', [rfreplaceall]);
// Result := StringReplace(result, '„', '&auml;', [rfreplaceall]); // ANSI
// Result := StringReplace(result, 'â€', '&ouml;', [rfreplaceall]);
// Result := StringReplace(result, '?', '&uuml;', [rfreplaceall]);
// Result := StringReplace(result, 'Ž', '&Auml;', [rfreplaceall]);
// Result := StringReplace(result, 'â„¢', '&Ouml;', [rfreplaceall]);
// Result := StringReplace(result, 'Å¡', '&Uuml;', [rfreplaceall]);
// Result := StringReplace(result, 'ß', '&szlig;', [rfreplaceall]);
    end;


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='.3gpthen Result := 3 else
      if Ext='.bmpthen Result := 4 else
      if Ext='.bmxthen Result := 5 else
      if Ext='.cssthen Result := 6 else
      if Ext='.hfithen Result := 7 else
      if Ext='.gifthen Result := 8 else
      if Ext='.htmlthen Result := 9 else
      if Ext='.imythen Result := 10 else
      if Ext='.jpgthen Result := 11 else
      if Ext='.midthen Result := 12 else
      if Ext='.mmcthen Result := 13 else
      if Ext='.mmfthen Result := 14 else
      if Ext='.mp3then Result := 15 else
      if Ext='.mp4then Result := 16 else
      if Ext='.pngthen Result := 17 else
      if Ext='.srtthen Result := 18 else
      if Ext='.svgthen Result := 19 else
      if Ext='.tiffthen Result := 20 else
      if Ext='.vmgthen Result := 21 else
      if Ext='.wavthen Result := 22 else
      if Ext='.wbmpthen Result := 23 else
      if Ext='.xhtmlthen Result := 24 else
    if Ext='.xlsthen Result := 25 else
      if Ext='.derthen Result := 26 else
      if Ext='.docthen Result := 27 else
      if Ext='.datthen Result := 28 else
      if Ext='.jarthen Result := 29 else
      if Ext='.pdfthen Result := 30 else
      if Ext='.txtthen Result := 31 else
      if Ext='.jadthen Result := 32;
  end; //20050101T000000
  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 := 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 ='folderthen
    begin
      ListItem.ImageIndex := 1;
      ListItem.SubItems.Add(' <DIR>');
      ListItem.SubItems.Add('');
    end;
    if tmp.NodeName ='filethen
    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;
    TntLabel1.Caption := ProductID +':/';
      for I := 0 to PathList.Count - 1 do // Iterate
            begin
        TntLabel1.Caption := TntLabel1.Caption + '/'+ PathList.Strings[I];
end;
end;
Marcel
  Mit Zitat antworten Zitat