如何在具有.NET的FTP服务器上通过WinSCP检查更新?
我正在使用SynchronizationMode.Local
例如:
if(have_new_update){
MessageBox("U can update")
if(ok){
update();
}
}else{
return;
}
我的代码:
SessionOptions sessionOptions = new SessionOptions {
Protocol = Protocol.Ftp, HostName = ftp_url, UserName = username, Password = pass
};
using (Session session = new Session()) {
rtb_update_material.AppendText("\nConnected\n");
//Transferring
session.FileTransferred += FileTransferred;
session.FileTransferProgress += SessionProgressBar;
session.Open(sessionOptions);
SynchronizationResult synchronizationResult;
synchronizationResult = session.SynchronizeDirectories(SynchronizationMode.Local, @"MyPath\", "/", true);
synchronizationResult.Check();
if (synchronizationResult.IsSuccess)
rtb_update_material.AppendText("Done\n");
答案 0 :(得分:1)
使用Session.CompareDirectories
查找本地目录和远程目录之间的差异:
const response = await fetch(serverIp + "/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
fromApp: true,
email,
password
})
});