mirror of https://github.com/2dust/v2rayN
Optimizing reload core
parent
eeab8e4a90
commit
1f7eb2d48a
|
@ -124,7 +124,6 @@
|
|||
|
||||
#region global variable
|
||||
|
||||
public static bool reloadCore { get; set; }
|
||||
public static int statePort { get; set; }
|
||||
public static Job processJob { get; set; }
|
||||
public static bool ShowInTaskbar { get; set; }
|
||||
|
|
|
@ -195,16 +195,6 @@ namespace v2rayN.Handler
|
|||
config.guiItem.statisticsFreshRate = 1;
|
||||
}
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
Global.reloadCore = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.reloadCore = true;
|
||||
|
||||
}
|
||||
|
||||
LazyConfig.Instance.SetConfig(config);
|
||||
return 0;
|
||||
}
|
||||
|
@ -215,7 +205,6 @@ namespace v2rayN.Handler
|
|||
/// <returns></returns>
|
||||
public static int SaveConfig(ref Config config, bool reload = true)
|
||||
{
|
||||
Global.reloadCore = reload;
|
||||
|
||||
ToJsonFile(config);
|
||||
|
||||
|
@ -446,7 +435,6 @@ namespace v2rayN.Handler
|
|||
}
|
||||
|
||||
config.indexId = indexId;
|
||||
Global.reloadCore = true;
|
||||
|
||||
ToJsonFile(config);
|
||||
|
||||
|
@ -856,7 +844,6 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else if (profileItem.indexId == config.indexId)
|
||||
{
|
||||
Global.reloadCore = true;
|
||||
}
|
||||
|
||||
if (SqliteHelper.Instance.Replace(profileItem) > 0)
|
||||
|
@ -1461,8 +1448,6 @@ namespace v2rayN.Handler
|
|||
config.routingBasicItem.routingIndexId = routingItem.id;
|
||||
}
|
||||
|
||||
Global.reloadCore = true;
|
||||
|
||||
ToJsonFile(config);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -26,8 +26,6 @@ namespace v2rayN.Handler
|
|||
}
|
||||
|
||||
public void LoadCore(Config config)
|
||||
{
|
||||
if (Global.reloadCore)
|
||||
{
|
||||
var node = ConfigHandler.GetDefaultServer(ref config);
|
||||
if (node == null)
|
||||
|
@ -69,7 +67,6 @@ namespace v2rayN.Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int LoadCoreConfigString(Config config, List<ServerTestItem> _selecteds)
|
||||
{
|
||||
|
|
|
@ -540,8 +540,12 @@ namespace v2rayN.ViewModels
|
|||
_noticeHandler?.SendMessage(msg);
|
||||
if (success)
|
||||
{
|
||||
var indexIdOld = _config.indexId;
|
||||
RefreshServers();
|
||||
if (indexIdOld != _config.indexId)
|
||||
{
|
||||
Reload();
|
||||
}
|
||||
if (_config.uiItem.enableAutoAdjustMainLvColWidth)
|
||||
{
|
||||
_updateView("AdjustMainLvColWidth");
|
||||
|
@ -740,6 +744,7 @@ namespace v2rayN.ViewModels
|
|||
subRemarks = t.subRemarks,
|
||||
isActive = t.indexId == _config.indexId,
|
||||
sort = t33 == null ? 0 : t33.sort,
|
||||
delay = t33 == null ? 0 : t33.delay,
|
||||
delayVal = t33?.delay != 0 ? $"{t33?.delay} {Global.DelayUnit}" : string.Empty,
|
||||
speedVal = t33?.speed != 0 ? $"{t33?.speed} {Global.SpeedUnit}" : string.Empty,
|
||||
todayDown = t22 == null ? "" : Utils.HumanFy(t22.todayDown),
|
||||
|
@ -1367,7 +1372,6 @@ namespace v2rayN.ViewModels
|
|||
|
||||
public void Reload()
|
||||
{
|
||||
Global.reloadCore = true;
|
||||
_ = LoadV2ray();
|
||||
}
|
||||
|
||||
|
@ -1387,7 +1391,6 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
_coreHandler.LoadCore(_config);
|
||||
|
||||
Global.reloadCore = false;
|
||||
//ConfigHandler.SaveConfig(ref _config, false);
|
||||
|
||||
ChangeSystemProxyStatus(_config.sysProxyType, false);
|
||||
|
|
Loading…
Reference in New Issue