mirror of https://github.com/2dust/v2rayN
parent
2edbbc523a
commit
9c4dc185be
|
@ -116,18 +116,16 @@
|
|||
|
||||
public static readonly List<string> GeoFilesSources = new() {
|
||||
"",
|
||||
GeoUrl,
|
||||
@"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat",
|
||||
};
|
||||
|
||||
public static readonly List<string> SingboxRulesetSources = new() {
|
||||
"",
|
||||
SingboxRulesetUrl,
|
||||
@"https://raw.githubusercontent.com/runetfreedom/russia-v2ray-rules-dat/refs/heads/release/sing-box/rule-set-{0}/{1}.srs",
|
||||
};
|
||||
|
||||
public static readonly List<string> RoutingRulesSources = new() {
|
||||
"", //Default
|
||||
"",
|
||||
@"https://raw.githubusercontent.com/runetfreedom/russia-v2ray-custom-routing-list/refs/heads/main/template.json",
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using ServiceLib.Common;
|
||||
using System.Data;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Data;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
@ -1620,24 +1618,13 @@ namespace ServiceLib.Handler
|
|||
|
||||
public static int InitRouting(Config config, bool blImportAdvancedRules = false)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(config.constItem.routeRulesTemplateSourceUrl))
|
||||
{
|
||||
InitExternalRouting(config, blImportAdvancedRules);
|
||||
}
|
||||
else
|
||||
if (string.IsNullOrEmpty(config.constItem.routeRulesTemplateSourceUrl))
|
||||
{
|
||||
InitBuiltinRouting(config, blImportAdvancedRules);
|
||||
}
|
||||
|
||||
if (GetLockedRoutingItem(config) == null)
|
||||
else
|
||||
{
|
||||
var item1 = new RoutingItem()
|
||||
{
|
||||
remarks = "locked",
|
||||
url = string.Empty,
|
||||
locked = true,
|
||||
};
|
||||
AddBatchRoutingRules(ref item1, Utils.GetEmbedText(Global.CustomRoutingFileName + "locked"));
|
||||
InitExternalRouting(config, blImportAdvancedRules);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1645,10 +1632,10 @@ namespace ServiceLib.Handler
|
|||
|
||||
public static int InitExternalRouting(Config config, bool blImportAdvancedRules = false)
|
||||
{
|
||||
DownloadService downloadHandle = new DownloadService();
|
||||
var downloadHandle = new DownloadService();
|
||||
var templateContent = Task.Run(() => downloadHandle.TryDownloadString(config.constItem.routeRulesTemplateSourceUrl, false, "")).Result;
|
||||
if (String.IsNullOrEmpty(templateContent))
|
||||
return InitBuiltinRouting(config, blImportAdvancedRules); // fallback
|
||||
return InitBuiltinRouting(config, blImportAdvancedRules); // fallback
|
||||
|
||||
var template = JsonUtils.Deserialize<RoutingTemplate>(templateContent);
|
||||
if (template == null)
|
||||
|
@ -1656,35 +1643,35 @@ namespace ServiceLib.Handler
|
|||
|
||||
var items = AppHandler.Instance.RoutingItems();
|
||||
var maxSort = items.Count;
|
||||
|
||||
if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(template.version)).ToList().Count <= 0)
|
||||
if (!blImportAdvancedRules && items.Where(t => t.remarks.StartsWith(template.version)).ToList().Count > 0)
|
||||
{
|
||||
for (var i = 0; i < template.routingItems.Length; i++)
|
||||
return 0;
|
||||
}
|
||||
for (var i = 0; i < template.routingItems.Length; i++)
|
||||
{
|
||||
var item = template.routingItems[i];
|
||||
|
||||
if (String.IsNullOrEmpty(item.url) && String.IsNullOrEmpty(item.ruleSet))
|
||||
continue;
|
||||
|
||||
var ruleSetsString = !String.IsNullOrEmpty(item.ruleSet)
|
||||
? item.ruleSet
|
||||
: Task.Run(() => downloadHandle.TryDownloadString(item.url, false, "")).Result;
|
||||
|
||||
if (String.IsNullOrEmpty(ruleSetsString))
|
||||
continue;
|
||||
|
||||
item.remarks = $"{template.version}-{item.remarks}";
|
||||
item.enabled = true;
|
||||
item.sort = ++maxSort;
|
||||
item.url = string.Empty;
|
||||
|
||||
AddBatchRoutingRules(ref item, ruleSetsString);
|
||||
|
||||
//first rule as default at first startup
|
||||
if (!blImportAdvancedRules && i == 0)
|
||||
{
|
||||
var item = template.routingItems[i];
|
||||
|
||||
if (String.IsNullOrEmpty(item.url) && String.IsNullOrEmpty(item.ruleSet))
|
||||
continue;
|
||||
|
||||
var ruleSetsString = !String.IsNullOrEmpty(item.ruleSet)
|
||||
? item.ruleSet
|
||||
: Task.Run(() => downloadHandle.TryDownloadString(item.url, false, "")).Result;
|
||||
|
||||
if (String.IsNullOrEmpty(ruleSetsString))
|
||||
continue;
|
||||
|
||||
item.remarks = $"{template.version}-{item.remarks}";
|
||||
item.enabled = true;
|
||||
item.sort = ++maxSort;
|
||||
item.url = string.Empty;
|
||||
|
||||
AddBatchRoutingRules(ref item, ruleSetsString);
|
||||
|
||||
//first rule as default at first startup
|
||||
if (!blImportAdvancedRules && i == 0)
|
||||
{
|
||||
SetDefaultRouting(config, item);
|
||||
}
|
||||
SetDefaultRouting(config, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1695,45 +1682,47 @@ namespace ServiceLib.Handler
|
|||
{
|
||||
var ver = "V3-";
|
||||
var items = AppHandler.Instance.RoutingItems();
|
||||
if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(ver)).ToList().Count <= 0)
|
||||
if (!blImportAdvancedRules && items.Where(t => t.remarks.StartsWith(ver)).ToList().Count > 0)
|
||||
{
|
||||
var maxSort = items.Count;
|
||||
//Bypass the mainland
|
||||
var item2 = new RoutingItem()
|
||||
{
|
||||
remarks = $"{ver}绕过大陆(Whitelist)",
|
||||
url = string.Empty,
|
||||
sort = maxSort + 1,
|
||||
};
|
||||
AddBatchRoutingRules(ref item2, Utils.GetEmbedText(Global.CustomRoutingFileName + "white"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Blacklist
|
||||
var item3 = new RoutingItem()
|
||||
{
|
||||
remarks = $"{ver}黑名单(Blacklist)",
|
||||
url = string.Empty,
|
||||
sort = maxSort + 2,
|
||||
};
|
||||
AddBatchRoutingRules(ref item3, Utils.GetEmbedText(Global.CustomRoutingFileName + "black"));
|
||||
var maxSort = items.Count;
|
||||
//Bypass the mainland
|
||||
var item2 = new RoutingItem()
|
||||
{
|
||||
remarks = $"{ver}绕过大陆(Whitelist)",
|
||||
url = string.Empty,
|
||||
sort = maxSort + 1,
|
||||
};
|
||||
AddBatchRoutingRules(ref item2, Utils.GetEmbedText(Global.CustomRoutingFileName + "white"));
|
||||
|
||||
//Global
|
||||
var item1 = new RoutingItem()
|
||||
{
|
||||
remarks = $"{ver}全局(Global)",
|
||||
url = string.Empty,
|
||||
sort = maxSort + 3,
|
||||
};
|
||||
AddBatchRoutingRules(ref item1, Utils.GetEmbedText(Global.CustomRoutingFileName + "global"));
|
||||
//Blacklist
|
||||
var item3 = new RoutingItem()
|
||||
{
|
||||
remarks = $"{ver}黑名单(Blacklist)",
|
||||
url = string.Empty,
|
||||
sort = maxSort + 2,
|
||||
};
|
||||
AddBatchRoutingRules(ref item3, Utils.GetEmbedText(Global.CustomRoutingFileName + "black"));
|
||||
|
||||
if (!blImportAdvancedRules)
|
||||
{
|
||||
SetDefaultRouting(config, item2);
|
||||
}
|
||||
//Global
|
||||
var item1 = new RoutingItem()
|
||||
{
|
||||
remarks = $"{ver}全局(Global)",
|
||||
url = string.Empty,
|
||||
sort = maxSort + 3,
|
||||
};
|
||||
AddBatchRoutingRules(ref item1, Utils.GetEmbedText(Global.CustomRoutingFileName + "global"));
|
||||
|
||||
if (!blImportAdvancedRules)
|
||||
{
|
||||
SetDefaultRouting(config, item2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static RoutingItem GetLockedRoutingItem(Config config)
|
||||
public static RoutingItem? GetLockedRoutingItem(Config config)
|
||||
{
|
||||
return SQLiteHelper.Instance.Table<RoutingItem>().FirstOrDefault(it => it.locked == true);
|
||||
}
|
||||
|
@ -1789,9 +1778,9 @@ namespace ServiceLib.Handler
|
|||
|
||||
#endregion DNS
|
||||
|
||||
#region Presets
|
||||
#region Regional Presets
|
||||
|
||||
public static bool ApplyPreset(Config config, EPresetType type)
|
||||
public static bool ApplyRegionalPreset(Config config, EPresetType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -1813,6 +1802,6 @@ namespace ServiceLib.Handler
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Regional Presets
|
||||
}
|
||||
}
|
|
@ -1116,27 +1116,27 @@ namespace ServiceLib.Resx {
|
|||
/// <summary>
|
||||
/// 查找类似 Regional presets 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string menuPresets {
|
||||
public static string menuRegionalPresets {
|
||||
get {
|
||||
return ResourceManager.GetString("menuPresets", resourceCulture);
|
||||
return ResourceManager.GetString("menuRegionalPresets", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Default 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string menuPresetsDefault {
|
||||
public static string menuRegionalPresetsDefault {
|
||||
get {
|
||||
return ResourceManager.GetString("menuPresetsDefault", resourceCulture);
|
||||
return ResourceManager.GetString("menuRegionalPresetsDefault", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Russia 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string menuPresetsRussia {
|
||||
public static string menuRegionalPresetsRussia {
|
||||
get {
|
||||
return ResourceManager.GetString("menuPresetsRussia", resourceCulture);
|
||||
return ResourceManager.GetString("menuRegionalPresetsRussia", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2752,6 +2752,15 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Users in China region can ignore this item 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsChinaUserTip {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsChinaUserTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Color 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -3040,17 +3049,6 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Routing rules source (optional) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsRoutingRulesSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("TbSettingsRoutingRulesSource", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 HTTP Port 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -3204,6 +3202,15 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Routing rules source (optional) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsRoutingRulesSource {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsRoutingRulesSource", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Set Win10 UWP Loopback 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1339,13 +1339,16 @@
|
|||
<data name="TbSettingsRoutingRulesSource" xml:space="preserve">
|
||||
<value>Routing rules source (optional)</value>
|
||||
</data>
|
||||
<data name="menuPresets" xml:space="preserve">
|
||||
<value>Regional presets</value>
|
||||
<data name="menuRegionalPresets" xml:space="preserve">
|
||||
<value>Regional presets setting</value>
|
||||
</data>
|
||||
<data name="menuPresetsDefault" xml:space="preserve">
|
||||
<data name="menuRegionalPresetsDefault" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="menuPresetsRussia" xml:space="preserve">
|
||||
<data name="menuRegionalPresetsRussia" xml:space="preserve">
|
||||
<value>Russia</value>
|
||||
</data>
|
||||
<data name="TbSettingsChinaUserTip" xml:space="preserve">
|
||||
<value>Users in China region can ignore this item</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1333,4 +1333,19 @@
|
|||
<data name="TbSettingsSrsFilesSource" xml:space="preserve">
|
||||
<value>sing-box ruleset文件来源(可选)</value>
|
||||
</data>
|
||||
<data name="TbSettingsRoutingRulesSource" xml:space="preserve">
|
||||
<value>路由规则集来源(可选)</value>
|
||||
</data>
|
||||
<data name="TbSettingsChinaUserTip" xml:space="preserve">
|
||||
<value>中国区域用户可忽略此项</value>
|
||||
</data>
|
||||
<data name="menuRegionalPresets" xml:space="preserve">
|
||||
<value>区域预置设置</value>
|
||||
</data>
|
||||
<data name="menuRegionalPresetsDefault" xml:space="preserve">
|
||||
<value>默认区域</value>
|
||||
</data>
|
||||
<data name="menuRegionalPresetsRussia" xml:space="preserve">
|
||||
<value>俄罗斯</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1213,4 +1213,19 @@
|
|||
<data name="TbSettingsSrsFilesSource" xml:space="preserve">
|
||||
<value>sing-box ruleset文件來源(可選)</value>
|
||||
</data>
|
||||
<data name="TbSettingsRoutingRulesSource" xml:space="preserve">
|
||||
<value>路由规则集来源(可选)</value>
|
||||
</data>
|
||||
<data name="TbSettingsChinaUserTip" xml:space="preserve">
|
||||
<value>中国区域用户可忽略此项</value>
|
||||
</data>
|
||||
<data name="menuRegionalPresets" xml:space="preserve">
|
||||
<value>区域预置设置</value>
|
||||
</data>
|
||||
<data name="menuRegionalPresetsDefault" xml:space="preserve">
|
||||
<value>默认区域</value>
|
||||
</data>
|
||||
<data name="menuRegionalPresetsRussia" xml:space="preserve">
|
||||
<value>俄羅斯</value>
|
||||
</data>
|
||||
</root>
|
|
@ -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
|
||||
|
||||
|
|
|
@ -74,15 +74,15 @@
|
|||
<MenuItem x:Name="menuRoutingSetting" Header="{x:Static resx:ResUI.menuRoutingSetting}" />
|
||||
<MenuItem x:Name="menuDNSSetting" Header="{x:Static resx:ResUI.menuDNSSetting}" />
|
||||
<MenuItem x:Name="menuGlobalHotkeySetting" Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" />
|
||||
<MenuItem Header="{x:Static resx:ResUI.menuPresets}">
|
||||
<MenuItem x:Name="menuPresetsDefault" Header="{x:Static resx:ResUI.menuPresetsDefault}" />
|
||||
<MenuItem x:Name="menuPresetsRussia" Header="{x:Static resx:ResUI.menuPresetsRussia}" />
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem x:Name="menuRebootAsAdmin" Header="{x:Static resx:ResUI.menuRebootAsAdmin}" />
|
||||
<MenuItem x:Name="menuSettingsSetUWP" Header="{x:Static resx:ResUI.TbSettingsSetUWP}" />
|
||||
<MenuItem x:Name="menuClearServerStatistics" Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
|
||||
<Separator />
|
||||
<MenuItem Header="{x:Static resx:ResUI.menuRegionalPresets}">
|
||||
<MenuItem x:Name="menuRegionalPresetsDefault" Header="{x:Static resx:ResUI.menuRegionalPresetsDefault}" />
|
||||
<MenuItem x:Name="menuRegionalPresetsRussia" Header="{x:Static resx:ResUI.menuRegionalPresetsRussia}" />
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="menuBackupAndRestore" Header="{x:Static resx:ResUI.menuBackupAndRestore}" />
|
||||
<MenuItem x:Name="menuOpenTheFileLocation" Header="{x:Static resx:ResUI.menuOpenTheFileLocation}" />
|
||||
</MenuItem>
|
||||
|
|
|
@ -76,8 +76,8 @@ namespace v2rayN.Desktop.Views
|
|||
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.PresetDefaultCmd, v => v.menuPresetsDefault).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.PresetRussiaCmd, v => v.menuPresetsRussia).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.RegionalPresetDefaultCmd, v => v.menuRegionalPresetsDefault).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.RegionalPresetRussiaCmd, v => v.menuRegionalPresetsRussia).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}" />
|
||||
Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
|
@ -331,9 +332,10 @@
|
|||
Classes="Margin8" />
|
||||
<TextBlock
|
||||
Grid.Row="17"
|
||||
Grid.Column="3"
|
||||
Grid.Column="2"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}" />
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
@ -626,6 +628,13 @@
|
|||
Grid.Column="1"
|
||||
Width="300"
|
||||
Classes="Margin8" />
|
||||
<TextBlock
|
||||
Grid.Row="22"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="23"
|
||||
|
@ -639,6 +648,13 @@
|
|||
Grid.Column="1"
|
||||
Width="300"
|
||||
Classes="Margin8" />
|
||||
<TextBlock
|
||||
Grid.Row="23"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="24"
|
||||
|
@ -652,6 +668,14 @@
|
|||
Grid.Column="1"
|
||||
Width="300"
|
||||
Classes="Margin8" />
|
||||
<TextBlock
|
||||
Grid.Row="24"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
|
|
@ -38,52 +38,10 @@ namespace v2rayN.Desktop.Views
|
|||
this.Bind(ViewModel, vm => vm.EnableTun, v => v.togEnableTun.IsChecked).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SystemProxySelected, v => v.cmbSystemProxy.SelectedIndex).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings2.ItemsSource).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings2.SelectedItem).DisposeWith(disposables);
|
||||
|
||||
////system proxy
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlSystemProxyClear, v => v.menuSystemProxyClear2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlSystemProxySet, v => v.menuSystemProxySet2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlSystemProxyNothing, v => v.menuSystemProxyNothing2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlSystemProxyPac, v => v.menuSystemProxyPac2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.SystemProxyClearCmd, v => v.menuSystemProxyClear).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.SystemProxySetCmd, v => v.menuSystemProxySet).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.SystemProxyPacCmd, v => v.menuSystemProxyPac).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.SystemProxyNothingCmd, v => v.menuSystemProxyNothing).DisposeWith(disposables);
|
||||
|
||||
////routings and servers
|
||||
//this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings.ItemsSource).DisposeWith(disposables);
|
||||
//this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings.SelectedItem).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.menuRoutings.Visibility).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.sepRoutings.Visibility).DisposeWith(disposables);
|
||||
|
||||
//this.OneWayBind(ViewModel, vm => vm.Servers, v => v.cmbServers.ItemsSource).DisposeWith(disposables);
|
||||
//this.Bind(ViewModel, vm => vm.SelectedServer, v => v.cmbServers.SelectedItem).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlServers, v => v.cmbServers.Visibility).DisposeWith(disposables);
|
||||
|
||||
////tray menu
|
||||
//this.BindCommand(ViewModel, vm => vm.AddServerViaClipboardCmd, v => v.menuAddServerViaClipboard2).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan2).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.SubUpdateCmd, v => v.menuSubUpdate2).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.menuSubUpdateViaProxy2).DisposeWith(disposables);
|
||||
|
||||
//this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.NotifyLeftClickCmd, v => v.tbNotify.LeftClickCommand).DisposeWith(disposables);
|
||||
|
||||
////status bar
|
||||
//this.OneWayBind(ViewModel, vm => vm.InboundDisplay, v => v.txtInboundDisplay.Text).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.InboundLanDisplay, v => v.txtInboundLanDisplay.Text).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.RunningServerDisplay, v => v.txtRunningServerDisplay.Text).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.RunningInfoDisplay, v => v.txtRunningInfoDisplay.Text).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.SpeedProxyDisplay, v => v.txtSpeedProxyDisplay.Text).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.SpeedDirectDisplay, v => v.txtSpeedDirectDisplay.Text).DisposeWith(disposables);
|
||||
//this.Bind(ViewModel, vm => vm.EnableTun, v => v.togEnableTun.IsChecked).DisposeWith(disposables);
|
||||
|
||||
//this.Bind(ViewModel, vm => vm.SystemProxySelected, v => v.cmbSystemProxy.SelectedIndex).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings2.ItemsSource).DisposeWith(disposables);
|
||||
//this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings2.SelectedItem).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.cmbRoutings2.Visibility).DisposeWith(disposables);
|
||||
});
|
||||
|
||||
togEnableTun.IsVisible = (Utils.IsWindows() || AppHandler.Instance.IsAdministrator);
|
||||
}
|
||||
|
||||
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
||||
|
|
|
@ -171,16 +171,6 @@
|
|||
x:Name="menuGlobalHotkeySetting"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" />
|
||||
<MenuItem Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuPresets}">
|
||||
<MenuItem
|
||||
x:Name="menuPresetsDefault"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuPresetsDefault}" />
|
||||
<MenuItem
|
||||
x:Name="menuPresetsRussia"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuPresetsRussia}" />
|
||||
</MenuItem>
|
||||
<Separator Margin="-40,5" />
|
||||
<MenuItem
|
||||
x:Name="menuRebootAsAdmin"
|
||||
|
@ -195,6 +185,16 @@
|
|||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
|
||||
<Separator Margin="-40,5" />
|
||||
<MenuItem Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuRegionalPresets}">
|
||||
<MenuItem
|
||||
x:Name="menuRegionalPresetsDefault"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRegionalPresetsDefault}" />
|
||||
<MenuItem
|
||||
x:Name="menuRegionalPresetsRussia"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRegionalPresetsRussia}" />
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
x:Name="menuBackupAndRestore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
|
|
|
@ -98,8 +98,8 @@ namespace v2rayN.Views
|
|||
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.PresetDefaultCmd, v => v.menuPresetsDefault).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.PresetRussiaCmd, v => v.menuPresetsRussia).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.RegionalPresetDefaultCmd, v => v.menuRegionalPresetsDefault).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.RegionalPresetRussiaCmd, v => v.menuRegionalPresetsRussia).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
|
@ -95,7 +95,8 @@
|
|||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}" />
|
||||
Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
|
@ -374,10 +375,11 @@
|
|||
HorizontalAlignment="Left" />
|
||||
<TextBlock
|
||||
Grid.Row="17"
|
||||
Grid.Column="3"
|
||||
Grid.Column="2"
|
||||
Margin="{StaticResource Margin8}"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}" />
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
@ -864,6 +866,14 @@
|
|||
Margin="{StaticResource Margin8}"
|
||||
IsEditable="True"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
<TextBlock
|
||||
Grid.Row="22"
|
||||
Grid.Column="2"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="23"
|
||||
|
@ -880,6 +890,14 @@
|
|||
Margin="{StaticResource Margin8}"
|
||||
IsEditable="True"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
<TextBlock
|
||||
Grid.Row="23"
|
||||
Grid.Column="2"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="24"
|
||||
|
@ -896,6 +914,15 @@
|
|||
Margin="{StaticResource Margin8}"
|
||||
IsEditable="True"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
<TextBlock
|
||||
Grid.Row="24"
|
||||
Grid.Column="2"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
|
Loading…
Reference in New Issue