add info filter the preset value

This commit is contained in:
2dust 2023-02-01 09:53:37 +08:00
parent f40f926ce1
commit 3d0428c518
3 changed files with 11 additions and 4 deletions

View file

@ -105,6 +105,7 @@
public static readonly List<string> Protocols = new List<string> { "http", "tls", "bittorrent" }; public static readonly List<string> Protocols = new List<string> { "http", "tls", "bittorrent" };
public static readonly List<string> TunMtus = new List<string> { "9000", "1500" }; public static readonly List<string> TunMtus = new List<string> { "9000", "1500" };
public static readonly List<string> TunStacks = new List<string> { "gvisor", "system" }; public static readonly List<string> TunStacks = new List<string> { "gvisor", "system" };
public static readonly List<string> PresetMsgFilters = new List<string> { "^(?!.*proxy).*$", "^(?!.*direct).*$" };
#endregion #endregion

View file

@ -21,12 +21,13 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryHueLightBrush}" Foreground="{DynamicResource PrimaryHueLightBrush}"
Text="{x:Static resx:ResUI.MsgInformationTitle}" /> Text="{x:Static resx:ResUI.MsgInformationTitle}" />
<TextBox <ComboBox
x:Name="txtMsgFilter" x:Name="cmbMsgFilter"
Width="200" Width="200"
Margin="8,0" Margin="8,0"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.MsgFilterTitle}" materialDesign:HintAssist.Hint="{x:Static resx:ResUI.MsgFilterTitle}"
materialDesign:TextFieldAssist.HasClearButton="True" /> materialDesign:TextFieldAssist.HasClearButton="True"
IsEditable="True" />
<TextBlock <TextBlock
Margin="8,0" Margin="8,0"
VerticalAlignment="Center" VerticalAlignment="Center"

View file

@ -12,6 +12,11 @@ namespace v2rayN.Views
{ {
InitializeComponent(); InitializeComponent();
MessageBus.Current.Listen<string>("MsgView").Subscribe(x => DelegateAppendText(x)); MessageBus.Current.Listen<string>("MsgView").Subscribe(x => DelegateAppendText(x));
Global.PresetMsgFilters.ForEach(it =>
{
cmbMsgFilter.Items.Add(it);
});
cmbMsgFilter.Items.Add(string.Empty);
} }
void DelegateAppendText(string msg) void DelegateAppendText(string msg)
@ -30,7 +35,7 @@ namespace v2rayN.Views
{ {
return; return;
} }
var MsgFilter = txtMsgFilter.Text.TrimEx(); var MsgFilter = cmbMsgFilter.Text.TrimEx();
if (!Utils.IsNullOrEmpty(MsgFilter)) if (!Utils.IsNullOrEmpty(MsgFilter))
{ {
if (!Regex.IsMatch(msg, MsgFilter)) if (!Regex.IsMatch(msg, MsgFilter))