mirror of https://github.com/2dust/v2rayN
Optimize performance
parent
3bc7812e1a
commit
54adaffb92
|
@ -578,13 +578,11 @@ namespace v2rayN.Forms
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int k = lvSelecteds.Count - 1; k >= 0; k--)
|
|
||||||
{
|
ConfigHandler.RemoveServer(ref config, lvSelecteds);
|
||||||
ConfigHandler.RemoveServer(ref config, lvSelecteds[k]);
|
|
||||||
}
|
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
LoadV2ray();
|
LoadV2ray();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
|
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -236,19 +236,27 @@ namespace v2rayN.Handler
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int RemoveServer(ref Config config, int index)
|
public static int RemoveServer(ref Config config, List<int> indexs)
|
||||||
{
|
{
|
||||||
if (index < 0 || index > config.vmess.Count - 1)
|
var itemId = config.getItemId();
|
||||||
|
|
||||||
|
for (int k = indexs.Count - 1; k >= 0; k--)
|
||||||
{
|
{
|
||||||
return -1;
|
var index = indexs[k];
|
||||||
|
if (index < 0 || index > config.vmess.Count - 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.vmess.RemoveAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除
|
var index_ = config.vmess.FindIndex(it => it.getItemId() == itemId);
|
||||||
config.vmess.RemoveAt(index);
|
if (index_ >= 0)
|
||||||
|
{
|
||||||
|
config.index = index_;
|
||||||
//移除的是活动的
|
}
|
||||||
if (config.index.Equals(index))
|
else
|
||||||
{
|
{
|
||||||
if (config.vmess.Count > 0)
|
if (config.vmess.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -258,13 +266,8 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
config.index = -1;
|
config.index = -1;
|
||||||
}
|
}
|
||||||
Global.reloadV2ray = true;
|
|
||||||
}
|
|
||||||
else if (index < config.index)//移除活动之前的
|
|
||||||
{
|
|
||||||
config.index--;
|
|
||||||
Global.reloadV2ray = true;
|
|
||||||
}
|
}
|
||||||
|
Global.reloadV2ray = true;
|
||||||
|
|
||||||
ToJsonFile(config);
|
ToJsonFile(config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue