also hätte ne frage !!
funkt eigentlich Doslisting mit TStringGrid?
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44:
| function GetNameFromDirLine(Line: String; Var IsDirectory: Boolean): String; Var i: Integer; DosListing: Boolean; begin IsDirectory := Line[1] = 'd'; DosListing := false; for i := 0 to 7 do begin if (i = 2) and not IsDirectory then begin IsDirectory := Copy(Line, 1, Pos(' ', Line) - 1) = '<DIR>'; if not IsDirectory then DosListing := Line[1] in ['0'..'9'] else DosListing := true; end; Delete(Line, 1, Pos(' ', Line)); While Line[1] = ' ' do Delete(Line, 1, 1); if DosListing and (i = 2) then break; end; Result := Line; end;
procedure TNMFTP_FRAME.StringGrid1DblClick(Sender: TObject); Var Name, Line: String; IsDirectory: Boolean; begin if not NMFTP1.Connected then exit; Line := StringGrid1.Items[StringGrid1.ItemIndex]; Name := GetNameFromDirLine(Line, IsDirectory); if IsDirectory then begin ChangeDir(Name); end else begin try SaveDialog1.FileName := Name; if SaveDialog1.Execute then begin NMFTP1.Download(Name, SaveDialog1.FileName, true); end; finally NMFTP1.List; end; end; end; |
nun ja alles klappt wunderbar bis auf 2 sachen
Delphi-Quelltext
1: 2:
| Line := StringGrid1.Items[StringGrid1.ItemIndex]; Name := GetNameFromDirLine(Line, IsDirectory); |
weis jemand wie ich das prob lösen kann? durch die doslisting etc würde ich mir ne menge arbeit ersparen *g*
danke schon im voraus!
zero1