|
|
@ -6,12 +6,10 @@ namespace ServiceLib.Services |
|
|
|
public class UpdateService |
|
|
|
public class UpdateService |
|
|
|
{ |
|
|
|
{ |
|
|
|
private Action<bool, string>? _updateFunc; |
|
|
|
private Action<bool, string>? _updateFunc; |
|
|
|
private Config _config; |
|
|
|
|
|
|
|
private int _timeout = 30; |
|
|
|
private int _timeout = 30; |
|
|
|
|
|
|
|
|
|
|
|
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease) |
|
|
|
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_config = config; |
|
|
|
|
|
|
|
_updateFunc = updateFunc; |
|
|
|
_updateFunc = updateFunc; |
|
|
|
var url = string.Empty; |
|
|
|
var url = string.Empty; |
|
|
|
var fileName = string.Empty; |
|
|
|
var fileName = string.Empty; |
|
|
@ -53,7 +51,6 @@ namespace ServiceLib.Services |
|
|
|
|
|
|
|
|
|
|
|
public async Task CheckUpdateCore(ECoreType type, Config config, Action<bool, string> updateFunc, bool preRelease) |
|
|
|
public async Task CheckUpdateCore(ECoreType type, Config config, Action<bool, string> updateFunc, bool preRelease) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_config = config; |
|
|
|
|
|
|
|
_updateFunc = updateFunc; |
|
|
|
_updateFunc = updateFunc; |
|
|
|
var url = string.Empty; |
|
|
|
var url = string.Empty; |
|
|
|
var fileName = string.Empty; |
|
|
|
var fileName = string.Empty; |
|
|
@ -108,7 +105,6 @@ namespace ServiceLib.Services |
|
|
|
|
|
|
|
|
|
|
|
public async Task UpdateSubscriptionProcess(Config config, string subId, bool blProxy, Action<bool, string> updateFunc) |
|
|
|
public async Task UpdateSubscriptionProcess(Config config, string subId, bool blProxy, Action<bool, string> updateFunc) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_config = config; |
|
|
|
|
|
|
|
_updateFunc = updateFunc; |
|
|
|
_updateFunc = updateFunc; |
|
|
|
|
|
|
|
|
|
|
|
_updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart); |
|
|
|
_updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart); |
|
|
@ -454,7 +450,6 @@ namespace ServiceLib.Services |
|
|
|
|
|
|
|
|
|
|
|
private async Task UpdateGeoFile(string geoName, Config config, Action<bool, string> updateFunc) |
|
|
|
private async Task UpdateGeoFile(string geoName, Config config, Action<bool, string> updateFunc) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_config = config; |
|
|
|
|
|
|
|
_updateFunc = updateFunc; |
|
|
|
_updateFunc = updateFunc; |
|
|
|
|
|
|
|
|
|
|
|
var geoUrl = string.IsNullOrEmpty(config?.ConstItem.GeoSourceUrl) |
|
|
|
var geoUrl = string.IsNullOrEmpty(config?.ConstItem.GeoSourceUrl) |
|
|
@ -470,7 +465,6 @@ namespace ServiceLib.Services |
|
|
|
|
|
|
|
|
|
|
|
private async Task UpdateSrsFileAll(Config config, Action<bool, string> updateFunc) |
|
|
|
private async Task UpdateSrsFileAll(Config config, Action<bool, string> updateFunc) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_config = config; |
|
|
|
|
|
|
|
_updateFunc = updateFunc; |
|
|
|
_updateFunc = updateFunc; |
|
|
|
|
|
|
|
|
|
|
|
var geoipFiles = new List<string>(); |
|
|
|
var geoipFiles = new List<string>(); |
|
|
@ -521,9 +515,9 @@ namespace ServiceLib.Services |
|
|
|
|
|
|
|
|
|
|
|
private async Task UpdateSrsFile(string type, string srsName, Config config, Action<bool, string> updateFunc) |
|
|
|
private async Task UpdateSrsFile(string type, string srsName, Config config, Action<bool, string> updateFunc) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var srsUrl = string.IsNullOrEmpty(_config.ConstItem.SrsSourceUrl) |
|
|
|
var srsUrl = string.IsNullOrEmpty(config.ConstItem.SrsSourceUrl) |
|
|
|
? Global.SingboxRulesetUrl |
|
|
|
? Global.SingboxRulesetUrl |
|
|
|
: _config.ConstItem.SrsSourceUrl; |
|
|
|
: config.ConstItem.SrsSourceUrl; |
|
|
|
|
|
|
|
|
|
|
|
var fileName = $"{type}-{srsName}.srs"; |
|
|
|
var fileName = $"{type}-{srsName}.srs"; |
|
|
|
var targetPath = Path.Combine(Utils.GetBinPath("srss"), fileName); |
|
|
|
var targetPath = Path.Combine(Utils.GetBinPath("srss"), fileName); |
|
|
|