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

View File

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