Trigger build for hl2sdk-l4d changes.
5 uses SysUtils, Classes, Windows, IdFTPList, Math;
7 function CalcSpeed(eOld, eNew: Integer): String;
9 function GetAllFiles(Mask: String; Attr: Integer; Recursive: Boolean; ShowDirs: Boolean; ShowPath: Boolean = True): TStringList;
11 function GetAllDirs: TStringList;
17 function CalcSpeed(eOld, eNew: Integer): String;
19 Result := frmMain.Caption;
20 if (eOld < eNew) and (eOld <> 0) then begin
22 //eOld := eOld *2; // this is only used for faster updates...
23 Result := 'Metamod:Source - Uploading with ' + FloatToStr(RoundTo(eOld / 1024, -2)) + ' kb/s';
27 function GetAllFiles(Mask: String; Attr: Integer; Recursive: Boolean; ShowDirs: Boolean; ShowPath: Boolean = True): TStringList;
28 var eSearch: TSearchRec;
30 Result := TStringList.Create;
33 if FindFirst(Mask, Attr, eSearch) = 0 then
36 if eSearch.Name[1] <> '.' then begin
37 if ShowPath then begin
38 if ((eSearch.Attr and Attr) = eSearch.Attr) and ((eSearch.Attr and faDirectory) <> eSearch.Attr) then
39 Result.Add(ExtractFilePath(Mask) + eSearch.Name)
40 else if (ShowDirs) and ((eSearch.Attr and faDirectory) = eSearch.Attr) then
41 Result.Add(ExtractFilePath(Mask) + eSearch.Name);
44 if ((eSearch.Attr and Attr) = eSearch.Attr) and ((eSearch.Attr and faDirectory) <> eSearch.Attr) then
45 Result.Add(eSearch.Name)
46 else if (ShowDirs) and ((eSearch.Attr and faDirectory) = eSearch.Attr) then
47 Result.Add(eSearch.Name);
50 if ((eSearch.Attr and faDirectory) = eSearch.Attr) and (Recursive) then begin
51 with GetAllFiles(ExtractFilePath(Mask) + eSearch.Name + '\' + ExtractFileName(Mask), Attr, True, ShowDirs, ShowPath) do begin
52 Result.Text := Result.Text + Text;
57 until FindNext(eSearch) <> 0;
61 function GetAllDirs: TStringList;
62 var eList: TStringList;
65 eList := TStringList.Create;
66 frmMain.IdFTP.List(eList);
67 frmMain.IdFTP.DirectoryListing.LoadList(eList);
69 for i := 0 to frmMain.IdFTP.DirectoryListing.Count -1 do begin
70 if frmMain.IdFTP.DirectoryListing.Items[i].ItemType = ditDirectory then
71 eList.Add(frmMain.IdFTP.DirectoryListing.Items[i].FileName);
76 { This is another possibility I coded because I couldn't find another bug...
78 function GetAllDirs: TStringList;
79 var eList: TStringList;
82 eList := TStringList.Create;
83 frmMain.IdFTP.List(eList, '', True);
87 // +----------------------------------------------------------------+
88 // | drwxr-xr-x 5 web3 ftponly 2048 Jun 25 19:43 files |
89 // | drwxr-xr-x 2 web3 ftponly 2048 Jun 25 19:57 html |
90 // | drwxr-xr-x 3 root root 2048 Jun 20 05:03 log |
91 // | drwxrwxrwx 2 web3 ftponly 2048 Jun 19 2004 phptmp |
92 // +----------------------------------------------------------------+
95 // at first remove all non-directories from the list
96 for i := eList.Count -1 downto 0 do begin
97 if Pos('d', eList[i]) <> 1 then
100 // then we have to find the position where ALL filenames start...
101 for i := 0 to eList.Count -1 do begin
102 if (eStart = 0) and (Pos(':', eList[i]) <> 0) then
103 eStart := Pos(':', eList[i]);
110 for i := 0 to eList.Count -1 do begin
111 if Pos(':', eList[i]) <> 0 then begin
112 while (eStart <> Length(eList[i])) and (eList[i][eStart] <> #32) do
116 // remove the detail stuff...
117 for i := 0 to eList.Count -1 do
118 eList[i] := Copy(eList[i], eStart +1, Length(eList[i]));