剪贴板导入数量报告

pull/453/head
YFdyh000 2020-02-18 18:02:01 +08:00
parent 4089cc5cf0
commit e09210e6c3
6 changed files with 20 additions and 20 deletions

View File

@ -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

View File

@ -724,7 +724,7 @@ namespace v2rayN.Handler
/// <param name="config"></param>
/// <param name="clipboardData"></param>
/// <param name="subid"></param>
/// <returns></returns>
/// <returns>成功导入的数量</returns>
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;
}
/// <summary>

View File

@ -728,7 +728,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Imported bulk URL from clipboard successfully 的本地化字符串。
/// 查找类似 {0} servers have been imported from clipboard. 的本地化字符串。
/// </summary>
internal static string SuccessfullyImportedServerViaClipboard {
get {

View File

@ -175,7 +175,7 @@
<value>Successfully imported custom configuration server</value>
</data>
<data name="SuccessfullyImportedServerViaClipboard" xml:space="preserve">
<value>Imported bulk URL from clipboard successfully</value>
<value>{0} servers have been imported from clipboard.</value>
</data>
<data name="CustomServerTips" xml:space="preserve">
<value>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.</value>

View File

@ -175,7 +175,7 @@
<value>成功导入自定义配置服务器</value>
</data>
<data name="SuccessfullyImportedServerViaClipboard" xml:space="preserve">
<value>从剪贴板导入批量URL成功</value>
<value>成功从剪贴板导入 {0} 个服务器</value>
</data>
<data name="CustomServerTips" xml:space="preserve">
<value>注意,自定义配置完全依赖您自己的配置不能使用所有设置功能。在自定义配置inbound中有socks port等于设置中的port时系统代理才可用</value>

View File

@ -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)