mirror of https://github.com/2dust/v2rayN
Optimize storage performance
parent
5076f45674
commit
565a7b1680
|
@ -174,7 +174,7 @@ namespace v2rayN.Handler
|
||||||
/// <param name="vmessItem"></param>
|
/// <param name="vmessItem"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int AddServer(ref Config config, VmessItem vmessItem, int index)
|
public static int AddServer(ref Config config, VmessItem vmessItem, int index, bool toFile = true)
|
||||||
{
|
{
|
||||||
vmessItem.configVersion = 2;
|
vmessItem.configVersion = 2;
|
||||||
vmessItem.configType = (int)EConfigType.Vmess;
|
vmessItem.configType = (int)EConfigType.Vmess;
|
||||||
|
@ -212,8 +212,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToJsonFile(config);
|
if (toFile)
|
||||||
|
{
|
||||||
|
ToJsonFile(config);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +526,7 @@ namespace v2rayN.Handler
|
||||||
/// <param name="vmessItem"></param>
|
/// <param name="vmessItem"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int AddShadowsocksServer(ref Config config, VmessItem vmessItem, int index)
|
public static int AddShadowsocksServer(ref Config config, VmessItem vmessItem, int index, bool toFile = true)
|
||||||
{
|
{
|
||||||
vmessItem.configVersion = 2;
|
vmessItem.configVersion = 2;
|
||||||
vmessItem.configType = (int)EConfigType.Shadowsocks;
|
vmessItem.configType = (int)EConfigType.Shadowsocks;
|
||||||
|
@ -557,8 +559,11 @@ namespace v2rayN.Handler
|
||||||
Global.reloadV2ray = true;
|
Global.reloadV2ray = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToJsonFile(config);
|
if (toFile)
|
||||||
|
{
|
||||||
|
ToJsonFile(config);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +575,7 @@ namespace v2rayN.Handler
|
||||||
/// <param name="vmessItem"></param>
|
/// <param name="vmessItem"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int AddSocksServer(ref Config config, VmessItem vmessItem, int index)
|
public static int AddSocksServer(ref Config config, VmessItem vmessItem, int index, bool toFile = true)
|
||||||
{
|
{
|
||||||
vmessItem.configVersion = 2;
|
vmessItem.configVersion = 2;
|
||||||
vmessItem.configType = (int)EConfigType.Socks;
|
vmessItem.configType = (int)EConfigType.Socks;
|
||||||
|
@ -597,7 +602,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToJsonFile(config);
|
if (toFile)
|
||||||
|
{
|
||||||
|
ToJsonFile(config);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -610,7 +618,7 @@ namespace v2rayN.Handler
|
||||||
/// <param name="vmessItem"></param>
|
/// <param name="vmessItem"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int AddTrojanServer(ref Config config, VmessItem vmessItem, int index)
|
public static int AddTrojanServer(ref Config config, VmessItem vmessItem, int index, bool toFile = true)
|
||||||
{
|
{
|
||||||
vmessItem.configVersion = 2;
|
vmessItem.configVersion = 2;
|
||||||
vmessItem.configType = (int)EConfigType.Trojan;
|
vmessItem.configType = (int)EConfigType.Trojan;
|
||||||
|
@ -644,7 +652,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToJsonFile(config);
|
if (toFile)
|
||||||
|
{
|
||||||
|
ToJsonFile(config);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -754,40 +765,41 @@ namespace v2rayN.Handler
|
||||||
vmessItem.subid = subid;
|
vmessItem.subid = subid;
|
||||||
if (vmessItem.configType == (int)EConfigType.Vmess)
|
if (vmessItem.configType == (int)EConfigType.Vmess)
|
||||||
{
|
{
|
||||||
if (AddServer(ref config, vmessItem, -1) == 0)
|
if (AddServer(ref config, vmessItem, -1, false) == 0)
|
||||||
{
|
{
|
||||||
countServers++;
|
countServers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vmessItem.configType == (int)EConfigType.Shadowsocks)
|
else if (vmessItem.configType == (int)EConfigType.Shadowsocks)
|
||||||
{
|
{
|
||||||
if (AddShadowsocksServer(ref config, vmessItem, -1) == 0)
|
if (AddShadowsocksServer(ref config, vmessItem, -1, false) == 0)
|
||||||
{
|
{
|
||||||
countServers++;
|
countServers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vmessItem.configType == (int)EConfigType.Socks)
|
else if (vmessItem.configType == (int)EConfigType.Socks)
|
||||||
{
|
{
|
||||||
if (AddSocksServer(ref config, vmessItem, -1) == 0)
|
if (AddSocksServer(ref config, vmessItem, -1, false) == 0)
|
||||||
{
|
{
|
||||||
countServers++;
|
countServers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vmessItem.configType == (int)EConfigType.Trojan)
|
else if (vmessItem.configType == (int)EConfigType.Trojan)
|
||||||
{
|
{
|
||||||
if (AddTrojanServer(ref config, vmessItem, -1) == 0)
|
if (AddTrojanServer(ref config, vmessItem, -1, false) == 0)
|
||||||
{
|
{
|
||||||
countServers++;
|
countServers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vmessItem.configType == (int)EConfigType.VLESS)
|
else if (vmessItem.configType == (int)EConfigType.VLESS)
|
||||||
{
|
{
|
||||||
if (AddVlessServer(ref config, vmessItem, -1) == 0)
|
if (AddVlessServer(ref config, vmessItem, -1, false) == 0)
|
||||||
{
|
{
|
||||||
countServers++;
|
countServers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ToJsonFile(config);
|
||||||
return countServers;
|
return countServers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -915,7 +927,7 @@ namespace v2rayN.Handler
|
||||||
/// <param name="vmessItem"></param>
|
/// <param name="vmessItem"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int AddVlessServer(ref Config config, VmessItem vmessItem, int index)
|
public static int AddVlessServer(ref Config config, VmessItem vmessItem, int index, bool toFile = true)
|
||||||
{
|
{
|
||||||
vmessItem.configVersion = 2;
|
vmessItem.configVersion = 2;
|
||||||
vmessItem.configType = (int)EConfigType.VLESS;
|
vmessItem.configType = (int)EConfigType.VLESS;
|
||||||
|
@ -953,7 +965,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToJsonFile(config);
|
if (toFile)
|
||||||
|
{
|
||||||
|
ToJsonFile(config);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue