bug fixes

pull/3507/head
2dust 2023-03-16 20:11:10 +08:00
parent ccc10dbae4
commit 9ba963fc45
2 changed files with 21 additions and 28 deletions

View File

@ -972,46 +972,40 @@ namespace v2rayN.Handler
} }
profileItem.subid = subid; profileItem.subid = subid;
profileItem.isSub = isSub; profileItem.isSub = isSub;
var addStatus = -1;
if (profileItem.configType == EConfigType.VMess) if (profileItem.configType == EConfigType.VMess)
{ {
if (AddServer(ref config, profileItem, false) == 0) addStatus = AddServer(ref config, profileItem, false);
{
countServers++;
}
} }
else if (profileItem.configType == EConfigType.Shadowsocks) else if (profileItem.configType == EConfigType.Shadowsocks)
{ {
if (AddShadowsocksServer(ref config, profileItem, false) == 0) addStatus = AddShadowsocksServer(ref config, profileItem, false);
{
countServers++;
}
} }
else if (profileItem.configType == EConfigType.Socks) else if (profileItem.configType == EConfigType.Socks)
{ {
if (AddSocksServer(ref config, profileItem, false) == 0) addStatus = AddSocksServer(ref config, profileItem, false);
{
countServers++;
}
} }
else if (profileItem.configType == EConfigType.Trojan) else if (profileItem.configType == EConfigType.Trojan)
{ {
if (AddTrojanServer(ref config, profileItem, false) == 0) addStatus = AddTrojanServer(ref config, profileItem, false);
{
countServers++;
}
} }
else if (profileItem.configType == EConfigType.VLESS) else if (profileItem.configType == EConfigType.VLESS)
{ {
if (AddVlessServer(ref config, profileItem, false) == 0) addStatus = AddVlessServer(ref config, profileItem, false);
{
countServers++;
}
}
lstAdd.Add(profileItem);
} }
if (addStatus == 0)
{
countServers++;
lstAdd.Add(profileItem);
}
}
if (lstAdd.Count > 0)
{
SqliteHelper.Instance.InsertAll(lstAdd); SqliteHelper.Instance.InsertAll(lstAdd);
}
ToJsonFile(config); ToJsonFile(config);
return countServers; return countServers;

View File

@ -700,7 +700,7 @@ namespace v2rayN.ViewModels
_subId = SelectedSub?.id; _subId = SelectedSub?.id;
_config.subIndexId = _subId; _config.subIndexId = _subId;
RefreshServers(false); RefreshServers();
_updateView("ProfilesFocus"); _updateView("ProfilesFocus");
} }
@ -715,13 +715,12 @@ namespace v2rayN.ViewModels
RefreshServers(); RefreshServers();
} }
private void RefreshServers(bool blCheckDefault = true) private void RefreshServers()
{ {
List<ProfileItemModel> lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter); List<ProfileItemModel> lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter);
if (blCheckDefault)
{
ConfigHandler.SetDefaultServer(_config, lstModel); ConfigHandler.SetDefaultServer(_config, lstModel);
}
List<ServerStatItem> lstServerStat = new(); List<ServerStatItem> lstServerStat = new();
if (_statistics != null && _statistics.Enable) if (_statistics != null && _statistics.Enable)
{ {