 |
Changeset 3347
- Timestamp:
- 03/13/08 13:25:14
(9 months ago)
- Author:
- lmartin92
- Message:
Updated FtpFolder?; now all but one class is finished. Will finish soon. Then testing time :-)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3346 |
r3347 |
|
| 65 | 65 | _ftp = new FTPConnection(_toString, _username, _password, _port); |
|---|
| 66 | 66 | writable(); |
|---|
| | 67 | } |
|---|
| | 68 | |
|---|
| | 69 | package this(VfsFolder fol) |
|---|
| | 70 | { |
|---|
| | 71 | this(cast(FtpFolder)fol); |
|---|
| 67 | 72 | } |
|---|
| 68 | 73 | |
|---|
| … | … | |
| 524 | 529 | package this(FtpFolder fol, char[] path) |
|---|
| 525 | 530 | { |
|---|
| 526 | | _name = path[locatePrior(path, '/', cast(int)path.length) > locatePrior(path, '\\', path.length) && locatePrior(path, '/', path.length) != path.length ? locatePrior(path, '/', path.length) : locatePrior(path, '\\', path.length) .. path.length]; |
|---|
| 527 | | _toString = path; |
|---|
| | 531 | _name = path[locatePrior(path, '/', cast(int)path.length) > locatePrior(path, '\\', path.length) && locatePrior(path, '/', path.length) != path.length ? locatePrior(path, '/', path.length) : locatePrior(path, '\\', path.length) .. $]; |
|---|
| | 532 | _toString = fol.toString ~ path; |
|---|
| 528 | 533 | _folder = new FtpFolder(fol); |
|---|
| 529 | 534 | _filt.name = _name; |
|---|
| … | … | |
| 713 | 718 | class FtpFiles : VfsFiles |
|---|
| 714 | 719 | { |
|---|
| | 720 | FtpFile[] _files; |
|---|
| | 721 | FtpFolder[] _folders; |
|---|
| 715 | 722 | /*********************************************************************** |
|---|
| 716 | 723 | |
|---|
| … | … | |
| 721 | 728 | package this(FtpFolders folders) |
|---|
| 722 | 729 | { |
|---|
| | 730 | foreach(folder; folders) |
|---|
| | 731 | { |
|---|
| | 732 | _folders ~= new FtpFolder(folder); |
|---|
| | 733 | } |
|---|
| | 734 | populateFiles(); |
|---|
| | 735 | } |
|---|
| | 736 | |
|---|
| | 737 | private void populateFiles() |
|---|
| | 738 | { |
|---|
| | 739 | foreach(FtpFolder folder; _folders) |
|---|
| | 740 | { |
|---|
| | 741 | foreach(VfsFolder fol; folder) |
|---|
| | 742 | { |
|---|
| | 743 | FtpFolder cfol = cast(FtpFolder) fol; |
|---|
| | 744 | FtpFileInfo[] fis = cfol._ftp.ls(); |
|---|
| | 745 | foreach(FtpFileInfo fi; fis) |
|---|
| | 746 | { |
|---|
| | 747 | if(fi.type == FtpFileType.file || fi.type == FtpFileType.other || fi.type == FtpFileType.unknown) |
|---|
| | 748 | { |
|---|
| | 749 | _files ~= new FtpFile(cfol, fi.name); |
|---|
| | 750 | } |
|---|
| | 751 | } |
|---|
| | 752 | } |
|---|
| | 753 | } |
|---|
| 723 | 754 | } |
|---|
| 724 | 755 | |
|---|
| 725 | 756 | package this(FtpFile[] files) |
|---|
| 726 | 757 | { |
|---|
| | 758 | _files = files; |
|---|
| 727 | 759 | } |
|---|
| 728 | 760 | |
|---|
| … | … | |
| 739 | 771 | int opApply (int delegate(inout VfsFile) dg) |
|---|
| 740 | 772 | { |
|---|
| 741 | | return 0; |
|---|
| | 773 | int result; |
|---|
| | 774 | |
|---|
| | 775 | foreach(file; _files) |
|---|
| | 776 | { |
|---|
| | 777 | VfsFile x = file; |
|---|
| | 778 | if ((result = dg(x)) != 0) |
|---|
| | 779 | break; |
|---|
| | 780 | } |
|---|
| | 781 | |
|---|
| | 782 | return result; |
|---|
| 742 | 783 | } |
|---|
| 743 | 784 | |
|---|
| … | … | |
| 750 | 791 | uint files() |
|---|
| 751 | 792 | { |
|---|
| 752 | | return 0; |
|---|
| | 793 | return _files.length; |
|---|
| 753 | 794 | } |
|---|
| 754 | 795 | |
|---|
| … | … | |
| 761 | 802 | ulong bytes() |
|---|
| 762 | 803 | { |
|---|
| 763 | | return 0; |
|---|
| | 804 | ulong to_return; |
|---|
| | 805 | foreach(file; this) |
|---|
| | 806 | { |
|---|
| | 807 | to_return += file.size; |
|---|
| | 808 | } |
|---|
| | 809 | return to_return; |
|---|
| 764 | 810 | } |
|---|
| 765 | 811 | } |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic