Skip to content

Class FtpOperater

Namespace: Tool.Utils.FtpHelper
Assembly: Tool.Net.dll

FTP操作类

csharp
public class FtpOperater

Inheritance

objectFtpOperater

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)

Remarks

代码由逆血提供支持

Properties

FolderWX

Ftp密码

csharp
public string FolderWX { get; set; }

Property Value

string

FolderZJ

Ftp密码

csharp
public string FolderZJ { get; set; }

Property Value

string

Ftp

全局FTP访问变量

csharp
public FtpClient Ftp { get; set; }

Property Value

FtpClient

Pass

Ftp密码

csharp
public string Pass { get; set; }

Property Value

string

Server

Ftp服务器

csharp
public string Server { get; set; }

Property Value

string

User

Ftp用户

csharp
public string User { get; set; }

Property Value

string

Methods

AddMSCFile(string, string, string, string, string, string)

修改文件

csharp
public bool AddMSCFile(string ftpFolder, string ftpFileName, string localFolder, string localFileName, string BscInfo, string path)

Parameters

ftpFolder string

本地目录

ftpFileName string

本地文件名temp

localFolder string

本地目录

localFileName string

本地文件名

BscInfo string

path string

获得应用程序所在的完整的路径

Returns

bool

CanConnect()

测试FTP服务器是否可登陆

csharp
public bool CanConnect()

Returns

bool

DelFile(string, string)

删除文件

csharp
public bool DelFile(string ftpFolder, string ftpFileName)

Parameters

ftpFolder string

ftp目录

ftpFileName string

ftp文件名

Returns

bool

GetFile(string, string, string, string)

下载文件

csharp
public bool GetFile(string ftpFolder, string ftpFileName, string localFolder, string localFileName)

Parameters

ftpFolder string

ftp目录

ftpFileName string

ftp文件名

localFolder string

本地目录

localFileName string

本地文件名

Returns

bool

GetFileInfo(string, string)

得到FTP上文件信息

csharp
public string GetFileInfo(string ftpFolder, string ftpFileName)

Parameters

ftpFolder string

FTP目录

ftpFileName string

ftp文件名

Returns

string

GetFileInfoConnected(string, string)

得到FTP上文件信息

csharp
public string GetFileInfoConnected(string ftpFolder, string ftpFileName)

Parameters

ftpFolder string

FTP目录

ftpFileName string

ftp文件名

Returns

string

GetFileList(string, string)

得到文件列表

csharp
public string[] GetFileList(string ftpFolder, string strMask)

Parameters

ftpFolder string

FTP目录

strMask string

Returns

string[]

FTP通配符号

GetFileNoBinary(string, string, string, string)

下载文件

csharp
public bool GetFileNoBinary(string ftpFolder, string ftpFileName, string localFolder, string localFileName)

Parameters

ftpFolder string

ftp目录

ftpFileName string

ftp文件名

localFolder string

本地目录

localFileName string

本地文件名

Returns

bool

GetFtpClient()

得到FTP传输对象

csharp
public FtpClient GetFtpClient()

Returns

FtpClient

GetList(string)

得到文件列表

csharp
public string[] GetList(string strPath)

Parameters

strPath string

Returns

string[]

PutFile(string, string)

上传文件

csharp
public bool PutFile(string ftpFolder, string ftpFileName)

Parameters

ftpFolder string

ftp目录

ftpFileName string

ftp文件名

Returns

bool

基于Apache-2.0协议开源