mirror of https://github.com/2dust/v2rayN
fix: 当过滤器是无效的正则时, 会输出大量异常日志
parent
4eb076540e
commit
8285688ec9
|
@ -11,6 +11,10 @@ namespace v2rayN.Views
|
|||
public partial class MsgView
|
||||
{
|
||||
private static Config _config;
|
||||
|
||||
private string lastMsgFilter;
|
||||
private bool lastMsgFilterNotAvailable;
|
||||
|
||||
public MsgView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -28,29 +32,39 @@ namespace v2rayN.Views
|
|||
|
||||
void DelegateAppendText(string msg)
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action<string>(AppendText), DispatcherPriority.Send, msg);
|
||||
Dispatcher.BeginInvoke(AppendText, DispatcherPriority.Send, msg);
|
||||
}
|
||||
|
||||
public void AppendText(string msg)
|
||||
{
|
||||
if (msg.Equals(Global.CommandClearMsg))
|
||||
if (msg == Global.CommandClearMsg)
|
||||
{
|
||||
ClearMsg();
|
||||
return;
|
||||
}
|
||||
if (!togAutoRefresh.IsChecked.Value)
|
||||
if (togAutoRefresh.IsChecked == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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)) // 如果不是正则表达式会异常
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
lastMsgFilterNotAvailable = true;
|
||||
}
|
||||
}
|
||||
|
||||
lastMsgFilter = MsgFilter;
|
||||
|
||||
ShowMsg(msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue