* Implementing remote SSH profiles. * Fixing async terminal adds. * Improving behavior when new window is requested. * Minor changes. * Move ssh profiles to roaming, rename sshshellprofile to sshprofile
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using FluentTerminal.Models.Enums;
|
|
|
|
namespace FluentTerminal.Models
|
|
{
|
|
public static class SshConnectionInfoExtensions
|
|
{
|
|
public static SshConnectionInfoValidationResult GetValidationResult(this ISshConnectionInfo sshConnectionInfo,
|
|
bool allowNoUser = false)
|
|
{
|
|
var result = SshConnectionInfoValidationResult.Valid;
|
|
|
|
if (!allowNoUser && string.IsNullOrEmpty(sshConnectionInfo.Username))
|
|
{
|
|
result |= SshConnectionInfoValidationResult.UsernameEmpty;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(sshConnectionInfo.Host))
|
|
{
|
|
result |= SshConnectionInfoValidationResult.HostEmpty;
|
|
}
|
|
|
|
if (sshConnectionInfo.SshPort < 1)
|
|
{
|
|
result |= SshConnectionInfoValidationResult.SshPortZeroOrNegative;
|
|
}
|
|
|
|
if (!sshConnectionInfo.UseMosh)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
if (sshConnectionInfo.MoshPortFrom < 1)
|
|
{
|
|
result |= SshConnectionInfoValidationResult.MoshPortZeroOrNegative;
|
|
}
|
|
|
|
if (sshConnectionInfo.MoshPortFrom > sshConnectionInfo.MoshPortTo)
|
|
{
|
|
result |= SshConnectionInfoValidationResult.MoshPortRangeInvalid;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
}
|
|
} |