mirror of https://github.com/2dust/v2rayN
Fix update geoip
parent
e9b0372174
commit
a01b934fdb
|
@ -286,8 +286,8 @@ namespace v2rayN.Handler
|
||||||
await UpdateGeoFile("geosite", _config, update);
|
await UpdateGeoFile("geosite", _config, update);
|
||||||
await UpdateGeoFile("geoip", _config, update);
|
await UpdateGeoFile("geoip", _config, update);
|
||||||
|
|
||||||
await UpdateGeoFile4Singbox("geosite", _config, update);
|
await UpdateGeoFile4Singbox("geosite", _config, false, update);
|
||||||
await UpdateGeoFile4Singbox("geoip", _config, update);
|
await UpdateGeoFile4Singbox("geoip", _config, true, update);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ namespace v2rayN.Handler
|
||||||
await askToDownload(downloadHandle, url, false);
|
await askToDownload(downloadHandle, url, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateGeoFile4Singbox(string geoName, Config config, Action<bool, string> update)
|
private async Task UpdateGeoFile4Singbox(string geoName, Config config, bool needStop, Action<bool, string> update)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = update;
|
_updateFunc = update;
|
||||||
|
@ -614,9 +614,11 @@ namespace v2rayN.Handler
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
_updateFunc(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, geoName));
|
_updateFunc(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, geoName));
|
||||||
|
var coreHandler = Locator.Current.GetService<CoreHandler>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (needStop) coreHandler?.CoreStop();
|
||||||
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
|
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
|
@ -625,6 +627,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
File.Delete(fileName);
|
File.Delete(fileName);
|
||||||
}
|
}
|
||||||
|
if (needStop) coreHandler?.LoadCore();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -558,6 +558,7 @@ namespace v2rayN.ViewModels
|
||||||
ConfigHandler.InitBuiltinRouting(ref _config);
|
ConfigHandler.InitBuiltinRouting(ref _config);
|
||||||
ConfigHandler.InitBuiltinDNS(_config);
|
ConfigHandler.InitBuiltinDNS(_config);
|
||||||
_coreHandler = new CoreHandler(_config, UpdateHandler);
|
_coreHandler = new CoreHandler(_config, UpdateHandler);
|
||||||
|
Locator.CurrentMutable.RegisterLazySingleton(() => _coreHandler, typeof(CoreHandler));
|
||||||
|
|
||||||
if (_config.guiItem.enableStatistics)
|
if (_config.guiItem.enableStatistics)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue