Class TMFtp (unit CYFtp)

Inherits from

Tmsocket

Constructors


constructor Create(AOwner: TComponent);



Functions

procedure ChangeDirectory(name: String);


procedure ChangeToParentDirectory;


procedure CreateDirectory(dir: String);


procedure DeleteDirectory(dir: String);


procedure DeleteFile(filename: String);


function DirectoryExists(dir: String): Integer;


function FileExists(filename: String): Integer;


procedure FileSetAttr(filename: String; OwnerRead, OwnerWrite, OwnerExecute, GroupRead, GroupWrite, GroupExecute, PublicRead, PublicWrite, PublicExecute: Boolean);


procedure GetFile;


procedure IssueCommand(command: String);


procedure Login;


procedure MoveFile(filename, newdir: String);


procedure PutFile;

cancel the operation

procedure Quit;


procedure Refresh;


procedure RenameFile(oldname, newname: String);


procedure StopTransfer;


destructor Destroy;


procedure LookupNameDone;


function CheckError: Boolean;


procedure CloseProc;


procedure DataDoListing(sender: TObject);


procedure DataFileDisconnected(sender: TObject);


procedure DataListConnected(sender: TObject);

============================== data connection routines=================

procedure DataListDisconnected(sender: TObject);


procedure DataRetrFile(sender: TObject);


procedure DataStorConnected(sender: TObject);


procedure DidConnect(Sender: TObject);


procedure DoDisconnect(Sender: TObject);


procedure DoFtpError(e: FtpError);


procedure DoFtpInfo(info: FtpInfo; add: String);

FTP_ERROR: if Assigned(FOnError) then FOnError(Self, FtpError(Message.

procedure DoRead(Sender: TObject);

if Assigned(FOnRead) then FOnRead(Sender);

function DummyP: String;


function DummyPP: String;


procedure FatalError(e: FtpError);


procedure FtpLogin(line: String);


function GetInterval: Integer;


function GetUrl: String;

parsing the url line

procedure NTimerTimer(Sender: TObject);


procedure Proceed(s: String; n: Integer);


procedure Ready;

PostMessage(Handle,FTP_ERROR,Ord(e), 0);

function RecvText: String;


procedure SetDirectories(s: TStrings);


procedure SetFiles(s: TStrings);


procedure SetInterval(I: Integer);


procedure SetList(s: TStrings);

reformats the url, extra information(port, password etc.

procedure SetTransferMode(M: String; S: Integer);


function SetupDataPort: String;


procedure SetupDataPortPassive(S: String);

this line should not in the with block

procedure SetUrl(S: String);


procedure TimedOut(Sender: TObject);


procedure UserMessageHandler(var Message: TMessage);


procedure Write(line: String);


Properties

property Account : String


property Busy : Boolean


property Cache : Boolean


property CurrentDirectory : String


property FileMask : String


property InitialDirectory : String


property LocalFile : String


property NoopInterval : Integer


property Passive : Boolean


property Password : String


property Port :

provided by TMSock

property ProxyPassword : String


property ProxyPort : Integer


property ProxyServer : String


property ProxyType : TMFtpProxyType


property ProxyUsername : String


property RemoteFile : String


property Server :


property ServerType : TMFtpServerType


property Success : Boolean


property SupportResume : Boolean


property TimeOutArp :


property TimeOutConnect :


property TransferMode : TTransferType


property Username : String


property Version : String


property BytesTransferred : LongInt


property Connected : Boolean

avoiding warning here

property Directories : TStrings


property DirectoriesInfo : TMFtpFileInfoList


property DoingListing : Boolean


property Error : FtpError


property Files : TStrings


property FilesInfo : TMFtpFileInfoList


property Listing : TStrings


property TransferTime : LongInt


property URL : String


Events

event OnDirectoryChanged : TNotifyEvent


event OnDirectoryCreated : TNotifyEvent


event OnDirectoryDeleted : TNotifyEvent


event OnFileDeleted : TNotifyEvent


event OnFileReceived : TNotifyEvent


event OnFileRenamed : TNotifyEvent


event OnFileStored : TNotifyEvent


event OnFtpError : TMFtpErrorEvent


event OnFtpInfo : TMFtpInfoEvent


event OnFtpNeedInfo : TMFtpInfoNeededEvent


event OnFtpQuit : TNotifyEvent


event OnFtpReady : TNotifyEvent


event OnListingDone : TNotifyEvent


event OnLoggedIn : TNotifyEvent


Variables

Aborted : Boolean;


Buffer : array[0..BUFFER_SIZE] of Char;


Bytes : Longint;


ControlConnected : Boolean;


ControlLoggedIn : Boolean;


CurrentMode : String;


DataConnected : Boolean;


datafile : file;


DataPartialLine : String;


DataSocket : TMSocket;


DummyS : String;


errs : String;


FAcct : String;


FBusy : Boolean;


FCache : Boolean;


FDirectories : TStrings;


FDirectoriesInfo : TMFtpFileInfoList;


FDirectory : String;


FDirectoryChanged : TNotifyEvent;


FDirectoryCreated : TNotifyEvent;


FDirectoryDeleted : TNotifyEvent;


FDoingListing : Boolean;


FError : FtpError;


FFile : String;


FFileDeleted : TNotifyEvent;


FFileMask : String;


FFileReceived : TNotifyEvent;


FFileRenamed : TNotifyEvent;


FFiles : TStrings;


FFilesInfo : TMFtpFileInfoList;


FFileStored : TNotifyEvent;


FFTPQuit : TNotifyEvent;


FIDirectory : String;


FileOpened : Boolean;


FList : TStrings;


FListingDone : TNotifyEvent;


FLoggedIn : TNotifyEvent;


FMode : TTransferType;


FOnError : TMFtpErrorEvent;


FOnReady : TNotifyEvent;


FPass : String;


FPassive : Boolean;


FPPass : String;


FProxyPort : Integer;


FProxyServer : String;


FProxyType : TMFtpProxyType;


FPUser : String;


FromCache : Boolean;


FSelection : String;


FSuccess : Boolean;


FSupportResume : Boolean;


FtpInfoEvt : TMFtpInfoEvent;


FtpLastAction : TMFtpLastAction;


FtpPort : Integer;


FtpProc : TNewLineProc;


FtpServer : String;


FType : TMFtpServerType;


FUrl : String;


FUser : String;


FVersion : String;


Intermediate : Boolean;


ListeningSocket : TMSocket;


NeedInfo : TMFtpInfoNeededEvent;


NTimer : TTimer;


OnHold : Boolean;


PartialLine : String;


pstep : Integer;


ReadyMain : Boolean;


ReadyPort : Boolean;


Response : String;


rnto : String;


SaveList : Boolean;


StartTime : Longint;


step : Integer;


TransferAborted : Boolean;


TrTime : Longint;


URLMode : Boolean;



Constructors


constructor Create(AOwner: TComponent);


Functions


procedure ChangeDirectory(name: String);


procedure ChangeToParentDirectory;


procedure CreateDirectory(dir: String);


procedure DeleteDirectory(dir: String);


procedure DeleteFile(filename: String);


function DirectoryExists(dir: String): Integer;


function FileExists(filename: String): Integer;


procedure FileSetAttr(filename: String; OwnerRead, OwnerWrite, OwnerExecute, GroupRead, GroupWrite, GroupExecute, PublicRead, PublicWrite, PublicExecute: Boolean);


procedure GetFile;


procedure IssueCommand(command: String);


procedure Login;


procedure MoveFile(filename, newdir: String);


procedure PutFile;

cancel the operation


procedure Quit;


procedure Refresh;


procedure RenameFile(oldname, newname: String);


procedure StopTransfer;


destructor Destroy;


procedure LookupNameDone;


function CheckError: Boolean;


procedure CloseProc;


procedure DataDoListing(sender: TObject);


procedure DataFileDisconnected(sender: TObject);


procedure DataListConnected(sender: TObject);

============================== data connection routines=================


procedure DataListDisconnected(sender: TObject);


procedure DataRetrFile(sender: TObject);


procedure DataStorConnected(sender: TObject);


procedure DidConnect(Sender: TObject);


procedure DoDisconnect(Sender: TObject);


procedure DoFtpError(e: FtpError);


procedure DoFtpInfo(info: FtpInfo; add: String);

FTP_ERROR: if Assigned(FOnError) then FOnError(Self, FtpError(Message.WParam), 'Error');


procedure DoRead(Sender: TObject);

if Assigned(FOnRead) then FOnRead(Sender);


function DummyP: String;


function DummyPP: String;


procedure FatalError(e: FtpError);


procedure FtpLogin(line: String);


function GetInterval: Integer;


function GetUrl: String;

parsing the url line


procedure NTimerTimer(Sender: TObject);


procedure Proceed(s: String; n: Integer);


procedure Ready;

PostMessage(Handle,FTP_ERROR,Ord(e), 0);


function RecvText: String;


procedure SetDirectories(s: TStrings);


procedure SetFiles(s: TStrings);


procedure SetInterval(I: Integer);


procedure SetList(s: TStrings);

reformats the url, extra information(port, password etc.) is exclude


procedure SetTransferMode(M: String; S: Integer);


function SetupDataPort: String;


procedure SetupDataPortPassive(S: String);

this line should not in the with block


procedure SetUrl(S: String);


procedure TimedOut(Sender: TObject);


procedure UserMessageHandler(var Message: TMessage);


procedure Write(line: String);


Properties


property Account : String


property Busy : Boolean


property Cache : Boolean


property CurrentDirectory : String


property FileMask : String


property InitialDirectory : String


property LocalFile : String


property NoopInterval : Integer


property Passive : Boolean


property Password : String


property Port :

provided by TMSock


property ProxyPassword : String


property ProxyPort : Integer


property ProxyServer : String


property ProxyType : TMFtpProxyType


property ProxyUsername : String


property RemoteFile : String


property Server :


property ServerType : TMFtpServerType


property Success : Boolean


property SupportResume : Boolean


property TimeOutArp :


property TimeOutConnect :


property TransferMode : TTransferType


property Username : String


property Version : String


property BytesTransferred : LongInt


property Connected : Boolean

avoiding warning here


property Directories : TStrings


property DirectoriesInfo : TMFtpFileInfoList


property DoingListing : Boolean


property Error : FtpError


property Files : TStrings


property FilesInfo : TMFtpFileInfoList


property Listing : TStrings


property TransferTime : LongInt


property URL : String


Events


event OnDirectoryChanged : TNotifyEvent


event OnDirectoryCreated : TNotifyEvent


event OnDirectoryDeleted : TNotifyEvent


event OnFileDeleted : TNotifyEvent


event OnFileReceived : TNotifyEvent


event OnFileRenamed : TNotifyEvent


event OnFileStored : TNotifyEvent


event OnFtpError : TMFtpErrorEvent


event OnFtpInfo : TMFtpInfoEvent


event OnFtpNeedInfo : TMFtpInfoNeededEvent


event OnFtpQuit : TNotifyEvent


event OnFtpReady : TNotifyEvent


event OnListingDone : TNotifyEvent


event OnLoggedIn : TNotifyEvent


Variables


Aborted : Boolean;


Buffer : array[0..BUFFER_SIZE] of Char;


Bytes : Longint;


ControlConnected : Boolean;


ControlLoggedIn : Boolean;


CurrentMode : String;


DataConnected : Boolean;


datafile : file;


DataPartialLine : String;


DataSocket : TMSocket;


DummyS : String;


errs : String;


FAcct : String;


FBusy : Boolean;


FCache : Boolean;


FDirectories : TStrings;


FDirectoriesInfo : TMFtpFileInfoList;


FDirectory : String;


FDirectoryChanged : TNotifyEvent;


FDirectoryCreated : TNotifyEvent;


FDirectoryDeleted : TNotifyEvent;


FDoingListing : Boolean;


FError : FtpError;


FFile : String;


FFileDeleted : TNotifyEvent;


FFileMask : String;


FFileReceived : TNotifyEvent;


FFileRenamed : TNotifyEvent;


FFiles : TStrings;


FFilesInfo : TMFtpFileInfoList;


FFileStored : TNotifyEvent;


FFTPQuit : TNotifyEvent;


FIDirectory : String;


FileOpened : Boolean;


FList : TStrings;


FListingDone : TNotifyEvent;


FLoggedIn : TNotifyEvent;


FMode : TTransferType;


FOnError : TMFtpErrorEvent;


FOnReady : TNotifyEvent;


FPass : String;


FPassive : Boolean;


FPPass : String;


FProxyPort : Integer;


FProxyServer : String;


FProxyType : TMFtpProxyType;


FPUser : String;


FromCache : Boolean;


FSelection : String;


FSuccess : Boolean;


FSupportResume : Boolean;


FtpInfoEvt : TMFtpInfoEvent;


FtpLastAction : TMFtpLastAction;


FtpPort : Integer;


FtpProc : TNewLineProc;


FtpServer : String;


FType : TMFtpServerType;


FUrl : String;


FUser : String;


FVersion : String;


Intermediate : Boolean;


ListeningSocket : TMSocket;


NeedInfo : TMFtpInfoNeededEvent;


NTimer : TTimer;


OnHold : Boolean;


PartialLine : String;


pstep : Integer;


ReadyMain : Boolean;


ReadyPort : Boolean;


Response : String;


rnto : String;


SaveList : Boolean;


StartTime : Longint;


step : Integer;


TransferAborted : Boolean;


TrTime : Longint;


URLMode : Boolean;