fix: 当过滤器是无效的正则时, 会输出大量异常日志
This commit is contained in:
@@ -11,6 +11,10 @@ namespace v2rayN.Views
|
|||||||
public partial class MsgView
|
public partial class MsgView
|
||||||
{
|
{
|
||||||
private static Config _config;
|
private static Config _config;
|
||||||
|
|
||||||
|
private string lastMsgFilter;
|
||||||
|
private bool lastMsgFilterNotAvailable;
|
||||||
|
|
||||||
public MsgView()
|
public MsgView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -28,29 +32,39 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
void DelegateAppendText(string msg)
|
void DelegateAppendText(string msg)
|
||||||
{
|
{
|
||||||
Dispatcher.BeginInvoke(new Action<string>(AppendText), DispatcherPriority.Send, msg);
|
Dispatcher.BeginInvoke(AppendText, DispatcherPriority.Send, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendText(string msg)
|
public void AppendText(string msg)
|
||||||
{
|
{
|
||||||
if (msg.Equals(Global.CommandClearMsg))
|
if (msg == Global.CommandClearMsg)
|
||||||
{
|
{
|
||||||
ClearMsg();
|
ClearMsg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!togAutoRefresh.IsChecked.Value)
|
if (togAutoRefresh.IsChecked == false)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var MsgFilter = cmbMsgFilter.Text.TrimEx();
|
var MsgFilter = cmbMsgFilter.Text.TrimEx();
|
||||||
if (!Utils.IsNullOrEmpty(MsgFilter))
|
if (MsgFilter != lastMsgFilter) lastMsgFilterNotAvailable = false;
|
||||||
|
if (!string.IsNullOrEmpty(MsgFilter) && !lastMsgFilterNotAvailable)
|
||||||
{
|
{
|
||||||
if (!Regex.IsMatch(msg, MsgFilter))
|
try
|
||||||
{
|
{
|
||||||
return;
|
if (!Regex.IsMatch(msg, MsgFilter)) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>쳣
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
lastMsgFilterNotAvailable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lastMsgFilter = MsgFilter;
|
||||||
|
|
||||||
ShowMsg(msg);
|
ShowMsg(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user