public Task <bool> ReturnToParentDirectory() { return(Task.Run(() => { try { lock (persistentConnectionLock) { persistentConnection.ChangeCurrentWorkingDirectory(".."); CurrentRemotePath = persistentConnection.GetCurrentWorkingDirectory(); } return true; } catch (FTPResponseException ex) { FTPErrorNotifications?.Invoke(ex); } return false; })); }
public Task <bool> CreatePersistentConnection() { return(Task.Run(() => { try { lock (persistentConnectionLock) { persistentConnection?.Close(); persistentConnection = CreateConnection(Server, true); CurrentRemotePath = persistentConnection.GetCurrentWorkingDirectory(); } timerKeepAlive = new Timer((state) => { try { lock (persistentConnectionLock) { persistentConnection.SendNullCommand(); } } catch (FTPResponseException ex) { timerKeepAlive.Dispose(); timerKeepAlive = null; FTPErrorNotifications?.Invoke(ex); } }, null, 15000, 15000); return true; } catch (FTPResponseException ex) { FTPErrorNotifications?.Invoke(ex); } return false; })); }