From 25bbd90f17e89dfda7796d92cc541709e59c41e8 Mon Sep 17 00:00:00 2001 From: Student Main Date: Sun, 1 Mar 2020 21:45:45 +0800 Subject: [PATCH] show message when cipher not exist --- shadowsocks-csharp/Data/i18n.csv | 1 + shadowsocks-csharp/View/ConfigForm.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/shadowsocks-csharp/Data/i18n.csv b/shadowsocks-csharp/Data/i18n.csv index f2bf8a29..3b50567f 100644 --- a/shadowsocks-csharp/Data/i18n.csv +++ b/shadowsocks-csharp/Data/i18n.csv @@ -76,6 +76,7 @@ New server,Новый сервер,未配置的服务器,新伺服器,新規サ Move &Up,Выше,上移(&U),上移 (&U),上に移動 (&U) Move D&own,Ниже,下移(&O),下移 (&O),下に移動 (&O) deprecated,Устаревшее,不推荐,不推薦,非推奨 +"Encryption method {0} not exist, will replace with {1}",,"加密方法{0}不存在,将使用{1}代替",, ,,,, #Statistics Config,,,, ,,,, diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index caab2f6d..68fc3a7d 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -79,7 +79,14 @@ namespace Shadowsocks.View public static EncryptionMethod GetMethod(string name) { if (!init) Init(); - return methodByName[name]; + bool success = methodByName.TryGetValue(name, out EncryptionMethod method); + if (!success) + { + string defaultMethod = Server.DefaultMethod; + MessageBox.Show(I18N.GetString("Encryption method {0} not exist, will replace with {1}", name, defaultMethod), I18N.GetString("Shadowsocks")); + return methodByName[defaultMethod]; + } + return method; } private EncryptionMethod(string name, bool deprecated)