diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index dd54c1db..0f0f6ef8 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -809,9 +809,10 @@ namespace v2rayN.Forms private void menuAddServers_Click(object sender, EventArgs e) { string clipboardData = Utils.GetClipboardData(); - if (AddBatchServers(clipboardData) == 0) + int result = AddBatchServers(clipboardData); + if (result > 0) { - UI.Show(UIRes.I18N("SuccessfullyImportedServerViaClipboard")); + UI.Show(string.Format(UIRes.I18N("SuccessfullyImportedServerViaClipboard"), result)); } } @@ -823,16 +824,19 @@ namespace v2rayN.Forms private int AddBatchServers(string clipboardData, string subid = "") { - if (ConfigHandler.AddBatchServers(ref config, clipboardData, subid) != 0) + int counter; + int _Add() + { + return ConfigHandler.AddBatchServers(ref config, clipboardData, subid); + } + counter = _Add(); + if (counter < 1) { clipboardData = Utils.Base64Decode(clipboardData); - if (ConfigHandler.AddBatchServers(ref config, clipboardData, subid) != 0) - { - return -1; - } + counter = _Add(); } RefreshServers(); - return 0; + return counter; } #endregion @@ -1356,7 +1360,7 @@ namespace v2rayN.Forms } else { - if (AddBatchServers(result) == 0) + if (AddBatchServers(result) > 0) { UI.Show(UIRes.I18N("SuccessfullyImportedServerViaScan")); } @@ -1416,7 +1420,7 @@ namespace v2rayN.Forms ConfigHandler.RemoveServerViaSubid(ref config, id); AppendText(false, $"{hashCode}{UIRes.I18N("MsgClearSubscription")}"); RefreshServers(); - if (AddBatchServers(result, id) == 0) + if (AddBatchServers(result, id) > 0) { } else diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 3db74a47..b8fd7971 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -724,7 +724,7 @@ namespace v2rayN.Handler /// /// /// - /// + /// 成功导入的数量 public static int AddBatchServers(ref Config config, string clipboardData, string subid = "") { if (Utils.IsNullOrEmpty(clipboardData)) @@ -779,11 +779,7 @@ namespace v2rayN.Handler } } } - if (countServers > 0) - { - return 0; - } - return -1; + return countServers; } /// diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index 0e5092df..e8aa87e2 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -728,7 +728,7 @@ namespace v2rayN.Resx { } /// - /// 查找类似 Imported bulk URL from clipboard successfully 的本地化字符串。 + /// 查找类似 {0} servers have been imported from clipboard. 的本地化字符串。 /// internal static string SuccessfullyImportedServerViaClipboard { get { diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index b62bbc98..37d728d2 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -175,7 +175,7 @@ Successfully imported custom configuration server - Imported bulk URL from clipboard successfully + {0} servers have been imported from clipboard. Note that custom configuration relies entirely on your own configuration and does not work with all settings. The system agent is available when the socks port is equal to the port in the settings in the custom configuration inbound. diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index c7378691..9123de73 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -175,7 +175,7 @@ 成功导入自定义配置服务器 - 从剪贴板导入批量URL成功 + 成功从剪贴板导入 {0} 个服务器 注意,自定义配置完全依赖您自己的配置,不能使用所有设置功能。在自定义配置inbound中有socks port等于设置中的port时,系统代理才可用 diff --git a/v2rayN/v2rayN/Tool/UI.cs b/v2rayN/v2rayN/Tool/UI.cs index 8225a291..267c8366 100644 --- a/v2rayN/v2rayN/Tool/UI.cs +++ b/v2rayN/v2rayN/Tool/UI.cs @@ -7,7 +7,7 @@ namespace v2rayN { public static void Show(string msg) { - MessageBox.Show(msg); + MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Information); } public static DialogResult ShowYesNo(string msg)