public void Start() { int enter = -1; while (enter != 0) { monitoring.Start(); int.TryParse(Console.ReadLine(), out enter); } monitoring.Stop(); (monitoring as IDisposable)?.Dispose(); }
public IActionResult CheckConnection(string host, string user, string password) { try { var client = new FtpClient { Host = host, Credentials = new NetworkCredential(user, password) }; client.Connect(); var fileStructure = _directorySearch.GetRecursiveFilesJson(client, "/"); _monitoring.Start(1, client, fileStructure); return(Ok(fileStructure)); } catch (Exception ex) { return(BadRequest($"Error occured: {ex.Message}")); } }