mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-12 17:18:21 +03:00
@@ -45,8 +45,8 @@ namespace ServiceLib.ViewModels
|
||||
public ReactiveCommand<Unit, Unit> OpenTheFileLocationCmd { get; }
|
||||
|
||||
//Presets
|
||||
public ReactiveCommand<Unit, Unit> PresetDefaultCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> PresetRussiaCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> RegionalPresetDefaultCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> RegionalPresetRussiaCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
|
||||
|
||||
@@ -185,14 +185,14 @@ namespace ServiceLib.ViewModels
|
||||
await Reload();
|
||||
});
|
||||
|
||||
PresetDefaultCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
RegionalPresetDefaultCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await ApplyPreset(EPresetType.Default);
|
||||
await ApplyRegionalPreset(EPresetType.Default);
|
||||
});
|
||||
|
||||
PresetRussiaCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
RegionalPresetRussiaCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await ApplyPreset(EPresetType.Russia);
|
||||
await ApplyRegionalPreset(EPresetType.Russia);
|
||||
});
|
||||
|
||||
#endregion WhenAnyValue && ReactiveCommand
|
||||
@@ -202,7 +202,7 @@ namespace ServiceLib.ViewModels
|
||||
|
||||
private void Init()
|
||||
{
|
||||
ConfigHandler.InitRouting(_config);
|
||||
ConfigHandler.InitBuiltinRouting(_config);
|
||||
ConfigHandler.InitBuiltinDNS(_config);
|
||||
CoreHandler.Instance.Init(_config, UpdateHandler);
|
||||
TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler);
|
||||
@@ -445,7 +445,7 @@ namespace ServiceLib.ViewModels
|
||||
var ret = await _updateView?.Invoke(EViewAction.RoutingSettingWindow, null);
|
||||
if (ret == true)
|
||||
{
|
||||
ConfigHandler.InitRouting(_config);
|
||||
ConfigHandler.InitBuiltinRouting(_config);
|
||||
Locator.Current.GetService<StatusBarViewModel>()?.RefreshRoutingsMenu();
|
||||
Reload();
|
||||
}
|
||||
@@ -560,16 +560,14 @@ namespace ServiceLib.ViewModels
|
||||
|
||||
#region Presets
|
||||
|
||||
public async Task ApplyPreset(EPresetType type)
|
||||
public async Task ApplyRegionalPreset(EPresetType type)
|
||||
{
|
||||
ConfigHandler.ApplyPreset(_config, type);
|
||||
|
||||
await new UpdateService().UpdateGeoFileAll(_config, UpdateHandler);
|
||||
|
||||
ConfigHandler.ApplyRegionalPreset(_config, type);
|
||||
ConfigHandler.InitRouting(_config);
|
||||
Locator.Current.GetService<StatusBarViewModel>()?.RefreshRoutingsMenu();
|
||||
|
||||
ConfigHandler.SaveConfig(_config, false);
|
||||
await new UpdateService().UpdateGeoFileAll(_config, UpdateHandler);
|
||||
Reload();
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace ServiceLib.ViewModels
|
||||
_updateView = updateView;
|
||||
SelectedSource = new();
|
||||
|
||||
ConfigHandler.InitRouting(_config);
|
||||
ConfigHandler.InitBuiltinRouting(_config);
|
||||
|
||||
enableRoutingAdvanced = _config.routingBasicItem.enableRoutingAdvanced;
|
||||
domainStrategy = _config.routingBasicItem.domainStrategy;
|
||||
@@ -123,6 +123,17 @@ namespace ServiceLib.ViewModels
|
||||
private void BindingLockedData()
|
||||
{
|
||||
_lockedItem = ConfigHandler.GetLockedRoutingItem(_config);
|
||||
if (_lockedItem == null)
|
||||
{
|
||||
_lockedItem = new RoutingItem()
|
||||
{
|
||||
remarks = "locked",
|
||||
url = string.Empty,
|
||||
locked = true,
|
||||
};
|
||||
ConfigHandler.AddBatchRoutingRules(ref _lockedItem, Utils.GetEmbedText(Global.CustomRoutingFileName + "locked"));
|
||||
}
|
||||
|
||||
if (_lockedItem != null)
|
||||
{
|
||||
_lockedRules = JsonUtils.Deserialize<List<RulesItem>>(_lockedItem.ruleSet);
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace ServiceLib.ViewModels
|
||||
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> NotifyLeftClickCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> ExitCmd { get; }
|
||||
|
||||
#region System Proxy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user