2dust 3 years ago
parent d5aa307efb
commit b29fb1e2a3

@ -1033,6 +1033,56 @@ namespace v2rayN.Handler
}
}
private static int AddBatchServers4SsSIP008(ref Config config, string clipboardData, string subid, List<VmessItem> lstOriSub, string groupId)
{
if (Utils.IsNullOrEmpty(clipboardData))
{
return -1;
}
if (!Utils.IsNullOrEmpty(subid))
{
RemoveServerViaSubid(ref config, subid);
}
//SsSIP008
var lstSsServer = Utils.FromJson<List<SsServer>>(clipboardData);
if (lstSsServer == null || lstSsServer.Count <= 0)
{
var ssSIP008 = Utils.FromJson<SsSIP008>(clipboardData);
if (ssSIP008 != null && ssSIP008.servers != null && ssSIP008.servers.Count > 0)
{
lstSsServer = ssSIP008.servers;
}
}
if (lstSsServer != null && lstSsServer.Count > 0)
{
int counter = 0;
foreach (var it in lstSsServer)
{
var ssItem = new VmessItem()
{
subid = subid,
groupId = groupId,
remarks = it.remarks,
security = it.method,
id = it.password,
address = it.server,
port = Utils.ToInt(it.server_port)
};
if (AddShadowsocksServer(ref config, ssItem, false) == 0)
{
counter++;
}
}
ToJsonFile(config);
return counter;
}
return -1;
}
public static int AddBatchServers(ref Config config, string clipboardData, string subid, string groupId)
{
List<VmessItem> lstOriSub = null;
@ -1047,6 +1097,11 @@ namespace v2rayN.Handler
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, lstOriSub, groupId);
}
if (counter < 1)
{
counter = AddBatchServers4SsSIP008(ref config, clipboardData, subid, lstOriSub, groupId);
}
//maybe other sub
if (counter < 1)
{

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
namespace v2rayN.Mode
{
public class SsSIP008
{
public List<SsServer> servers { get; set; }
}
[Serializable]
public class SsServer
{
public string remarks { get; set; }
public string server { get; set; }
public string server_port { get; set; }
public string method { get; set; }
public string password { get; set; }
public string plugin { get; set; }
}
}

@ -216,6 +216,7 @@
<Compile Include="Mode\SysproxyConfig.cs" />
<Compile Include="Mode\EConfigType.cs" />
<Compile Include="Mode\ServerTestItem.cs" />
<Compile Include="Mode\SsSIP008.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>

Loading…
Cancel
Save