pull/2148/head
2dust 2022-03-18 20:30:08 +08:00
parent 8f17331db2
commit c3971bda05
2 changed files with 9 additions and 9 deletions

View File

@ -621,7 +621,7 @@ namespace v2rayN.Handler
/// <param name="clipboardData"></param>
/// <param name="subid"></param>
/// <returns>成功导入的数量</returns>
public static int AddBatchServers(ref Config config, string clipboardData, string subid, string groupId)
public static int AddBatchServers(ref Config config, string clipboardData, string subid, List<VmessItem> lstOriSub, string groupId)
{
if (Utils.IsNullOrEmpty(clipboardData))
{
@ -629,10 +629,8 @@ namespace v2rayN.Handler
}
//copy sub items
List<VmessItem> lstOriSub = null;
if (!Utils.IsNullOrEmpty(subid))
{
lstOriSub = config.vmess.Where(it => it.subid == subid).ToList();
RemoveServerViaSubid(ref config, subid);
}
//if (clipboardData.IndexOf("vmess") >= 0 && clipboardData.IndexOf("vmess") == clipboardData.LastIndexOf("vmess"))

View File

@ -1,12 +1,14 @@
using NHotkey;
using NHotkey.WindowsForms;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using v2rayN.Mode;
using System.Linq;
namespace v2rayN.Handler
{
@ -159,16 +161,16 @@ namespace v2rayN.Handler
public int AddBatchServers(Config config, string clipboardData, string subid, string groupId)
{
int counter;
int _Add()
List<VmessItem> lstOriSub = null;
if (!Utils.IsNullOrEmpty(subid))
{
return ConfigHandler.AddBatchServers(ref config, clipboardData, subid, groupId);
lstOriSub = config.vmess.Where(it => it.subid == subid).ToList();
}
counter = _Add();
int counter = ConfigHandler.AddBatchServers(ref config, clipboardData, subid, lstOriSub, groupId);
if (counter < 1)
{
clipboardData = Utils.Base64Decode(clipboardData);
counter = _Add();
counter = ConfigHandler.AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, lstOriSub, groupId);
}
return counter;