diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 2feba3ac..21cecfd3 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -1033,6 +1033,56 @@ namespace v2rayN.Handler } } + private static int AddBatchServers4SsSIP008(ref Config config, string clipboardData, string subid, List lstOriSub, string groupId) + { + if (Utils.IsNullOrEmpty(clipboardData)) + { + return -1; + } + + if (!Utils.IsNullOrEmpty(subid)) + { + RemoveServerViaSubid(ref config, subid); + } + + //SsSIP008 + var lstSsServer = Utils.FromJson>(clipboardData); + if (lstSsServer == null || lstSsServer.Count <= 0) + { + var ssSIP008 = Utils.FromJson(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 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) { diff --git a/v2rayN/v2rayN/Mode/SsSIP008.cs b/v2rayN/v2rayN/Mode/SsSIP008.cs new file mode 100644 index 00000000..6b3bbc24 --- /dev/null +++ b/v2rayN/v2rayN/Mode/SsSIP008.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +namespace v2rayN.Mode +{ + public class SsSIP008 + { + public List 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; } + } + +} diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj index d920419f..f912feb1 100644 --- a/v2rayN/v2rayN/v2rayN.csproj +++ b/v2rayN/v2rayN/v2rayN.csproj @@ -216,6 +216,7 @@ + True True