From 160752553921df1552dc78f8d827d15912b9295a Mon Sep 17 00:00:00 2001
From: 2dust <31833384+2dust@users.noreply.github.com>
Date: Wed, 8 Oct 2025 14:12:16 +0800
Subject: [PATCH] Optimize the ruletype UI
---
v2rayN/ServiceLib/Models/RulesItemModel.cs | 1 +
v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 18 ++++++
v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 6 ++
v2rayN/ServiceLib/Resx/ResUI.hu.resx | 6 ++
v2rayN/ServiceLib/Resx/ResUI.resx | 6 ++
v2rayN/ServiceLib/Resx/ResUI.ru.resx | 6 ++
v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 6 ++
v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 6 ++
.../ViewModels/RoutingRuleSettingViewModel.cs | 4 +-
.../Views/RoutingRuleDetailsWindow.axaml | 56 +++++++++++-------
.../Views/RoutingRuleSettingWindow.axaml | 14 ++---
.../Views/RoutingRuleDetailsWindow.xaml | 59 ++++++++++++-------
.../Views/RoutingRuleSettingWindow.xaml | 14 ++---
13 files changed, 146 insertions(+), 56 deletions(-)
diff --git a/v2rayN/ServiceLib/Models/RulesItemModel.cs b/v2rayN/ServiceLib/Models/RulesItemModel.cs
index 973f2b84..f3eda16b 100644
--- a/v2rayN/ServiceLib/Models/RulesItemModel.cs
+++ b/v2rayN/ServiceLib/Models/RulesItemModel.cs
@@ -7,4 +7,5 @@ public class RulesItemModel : RulesItem
public string Ips { get; set; }
public string Domains { get; set; }
public string Protocols { get; set; }
+ public string RuleTypeName { get; set; }
}
diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index 6b4257a1..fa04e98c 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -3156,6 +3156,24 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 Rule Type 的本地化字符串。
+ ///
+ public static string TbRuleType {
+ get {
+ return ResourceManager.GetString("TbRuleType", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 You can set separate rules for Routing and DNS, or select "ALL" to apply to both 的本地化字符串。
+ ///
+ public static string TbRuleTypeTips {
+ get {
+ return ResourceManager.GetString("TbRuleTypeTips", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Bootstrap DNS (sing-box) 的本地化字符串。
///
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
index ae08f28d..9fda034c 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
@@ -1596,4 +1596,10 @@
If the system does not have a tray function, please do not enable it
+
+ Rule Type
+
+
+ You can set separate rules for Routing and DNS, or select "ALL" to apply to both
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
index 00fbced7..49e7e8c4 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
@@ -1596,4 +1596,10 @@
If the system does not have a tray function, please do not enable it
+
+ You can set separate rules for Routing and DNS, or select "ALL" to apply to both
+
+
+ Rule Type
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index 5b08c334..4836f005 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -1596,4 +1596,10 @@
If the system does not have a tray function, please do not enable it
+
+ You can set separate rules for Routing and DNS, or select "ALL" to apply to both
+
+
+ Rule Type
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
index e82d874f..5fd8640f 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
@@ -1596,4 +1596,10 @@
If the system does not have a tray function, please do not enable it
+
+ You can set separate rules for Routing and DNS, or select "ALL" to apply to both
+
+
+ Rule Type
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
index 404354ef..eaf55173 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -1593,4 +1593,10 @@
如果系统没有托盘功能,请不要开启
+
+ 规则类型
+
+
+ 可对 Routing 和 DNS 单独设定规则,ALL 则都生效
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index f3fd34c5..0ee39e31 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -1593,4 +1593,10 @@
如果系統沒有托盤功能,請不要開啟
+
+ 规则类型
+
+
+ 可对 Routing 和 DNS 单独设定规则,ALL 则都生效
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs
index 4b192f04..979d3dc4 100644
--- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs
@@ -107,13 +107,13 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
var it = new RulesItemModel()
{
Id = item.Id,
+ RuleTypeName = item.RuleType?.ToString(),
OutboundTag = item.OutboundTag,
Port = item.Port,
Network = item.Network,
Protocols = Utils.List2String(item.Protocol),
InboundTags = Utils.List2String(item.InboundTag),
- Domains = Utils.List2String(item.Domain),
- Ips = Utils.List2String(item.Ip),
+ Domains = Utils.List2String((item.Domain ?? []).Concat(item.Ip ?? []).ToList()),
Enabled = item.Enabled,
Remarks = item.Remarks,
};
diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml
index 61c561a1..30f74a14 100644
--- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml
@@ -18,7 +18,7 @@
Margin="{StaticResource Margin4}"
ColumnDefinitions="Auto,Auto,Auto"
DockPanel.Dock="Top"
- RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
+ RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto">
-
@@ -57,16 +52,37 @@
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
+ Text="{x:Static resx:ResUI.TbRuleType}" />
+
+
+
+
@@ -126,20 +142,20 @@
+
-
+ Header="domain / ip" />
diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml
index af7f0a50..acf1c7f2 100644
--- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml
+++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml
@@ -26,6 +26,7 @@
+
@@ -60,12 +61,6 @@
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
VerticalAlignment="Center" />
-
+
+
+
+
+
-
+ Header="domain / ip" />