Einzelnen Beitrag anzeigen

jaschu

Registriert seit: 21. Mär 2005
38 Beiträge
 
#7

Re: AV bei array größer 2000

  Alt 28. Sep 2005, 19:06
Hm, hier mal die komplette Unit:

Delphi-Quellcode:
unit USource;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TDsatz = RECORD
               id, playcount : Integer;
               pfad: String[255];
               Interpret, songname, listid : String[80];
             END;


  Tmp3list = class
    private
      items: Array of TDsatz;
      function GetCount: Integer;
    public
      procedure newdirlist(pfad : String);
      procedure addlist(neu : Tmp3list);
      procedure listdircontent(Verzeichnis :string; var listenname:TStringlist);
      property count: Integer read GetCount;
    end;


  var usertime, guesstime, maxpoints : Integer; sollid3tag : Boolean; kompletteliste : tmp3list;
  implementation



  procedure Tmp3list.newdirlist(pfad : String);
  var liste,tempdirlist, fertigtemp : TStringlist; akt : String; x : Integer;
  begin
      x := 0 ;
      fertigtemp := TStringlist.Create;
      liste := TStringlist.Create;
      listdircontent(pfad, liste);
      while liste.Count > 0 do
      begin
         akt := liste.strings[x];
         if extractfileext(akt) = '.mp3then
           fertigtemp.Add(akt)
         else
         if directoryexists(akt) then
         begin
           tempdirlist := TStringlist.Create;
           listdircontent(akt, tempdirlist);
           liste.AddStrings(tempdirlist);
         end;
         liste.delete(x);
      end;
      setlength(items, fertigtemp.count);
      for x := 0 to fertigtemp.count-1 do
      begin
        items[x].pfad := fertigtemp.Strings[x];
        items[x].listid := pfad;
      end;
  end;


  function tmp3list.getcount : Integer;
  begin
    result := length(items);
  end;


  procedure Tmp3list.listdircontent(Verzeichnis :string; var listenname:TStringlist);
  var SR: TSearchRec;
  begin
    if Verzeichnis[length(Verzeichnis)]<>'\then
      Verzeichnis:=Verzeichnis+'\';
    if FindFirst(Verzeichnis+'*.*',$3F,SR)=0 then begin
      repeat
        if (SR.Name<>'.') and (SR.Name<>'..') then
          listenname.Add(Verzeichnis+SR.Name);
      until FindNext(SR)<>0;
      FindClose(SR);
    end;
  end;


  procedure tmp3list.addlist(neu : Tmp3list);
  var tmp, tmp2,x : Integer;
  begin
    x := 0;
    tmp := getcount;
    tmp2 := neu.count;
    setlength(items, tmp + tmp2);
    for tmp := tmp to tmp + tmp2 do
    begin
      items[tmp] := neu.items[x];
      inc(x);
    end;
  end;

end.
  Mit Zitat antworten Zitat