string ExtractHostNameFromPath(string path)
{
Uri uriForSftp;
if(Uri.TryCreate(path, UriKind.RelativeOrAbsolute, out uriForSftp))
{
try
{
return uriForSftp.Host;
}
catch(Exception)
{
throw new Exception("The path is in the incorrect format.");
}
}
return "";
}