aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-09-10 17:38:57 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-09-10 17:38:57 -0500
commitcad5239f816bc3f116a6ad8d3dea9e1e3f831a65 (patch)
treebff5f4820e77903c1e893910ece4d9fa8bed923c /src
parentbc362491446e4bfa94b7891ac0694d4f9b35df16 (diff)
downloadslskd-cad5239f816bc3f116a6ad8d3dea9e1e3f831a65.tar.gz
simplify enum handling
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Integrations/FTP/FTPClientFactory.cs16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/slskd/Integrations/FTP/FTPClientFactory.cs b/src/slskd/Integrations/FTP/FTPClientFactory.cs
index 2e41ab03..70cfbc03 100644
--- a/src/slskd/Integrations/FTP/FTPClientFactory.cs
+++ b/src/slskd/Integrations/FTP/FTPClientFactory.cs
@@ -47,24 +47,10 @@ namespace slskd.Integrations.FTP
public FtpClient CreateFtpClient()
{
var client = new FtpClient(FtpOptions.Address, FtpOptions.Port, FtpOptions.Username, FtpOptions.Password);
- client.EncryptionMode = ParseFtpEncryptionMode(FtpOptions.EncryptionMode);
+ client.EncryptionMode = FtpOptions.EncryptionMode.ToEnum<FtpEncryptionMode>();
client.ValidateAnyCertificate = FtpOptions.IgnoreCertificateErrors;
return client;
}
-
- private FtpEncryptionMode ParseFtpEncryptionMode(string encryptionMode)
- {
- try
- {
- return (FtpEncryptionMode)Enum.Parse(typeof(FtpEncryptionMode), encryptionMode, ignoreCase: true);
- }
- catch (Exception ex)
- {
- // Options should validate that the given string is parsable to FtpEncryptionMode through EnumAttribute; if this
- // throws there's a bug somewhere.
- throw new ArgumentException($"Failed to parse {typeof(FtpEncryptionMode).Name} from application Options. This is most likely a programming error; please file a GitHub issue and include your FTP configuration.", ex);
- }
- }
}
} \ No newline at end of file