From b871d0443ec97010149a46b65be99151cdec9075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3?= Date: Sat, 7 Sep 2024 13:26:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BC=B9=E5=B9=95=E5=BD=95?= =?UTF-8?q?=E5=88=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/RuntimeObject/Download/Basics.cs | 4 ++-- Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs | 4 ++-- Desktop/Views/Windows/VlcPlayWindow.xaml.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/RuntimeObject/Download/Basics.cs b/Core/RuntimeObject/Download/Basics.cs index 36dbfbed..a7edee4f 100644 --- a/Core/RuntimeObject/Download/Basics.cs +++ b/Core/RuntimeObject/Download/Basics.cs @@ -421,7 +421,7 @@ public static void LiveChatListener_MessageReceived(object? sender, Core.LiveCha case DanmuMessageEventArgs Danmu: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(Danmu.Message.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && Danmu.Message.Contains(word))) { return; } @@ -492,7 +492,7 @@ public static void LiveChatListener_MessageReceived(object? sender, Core.LiveCha case SendGiftEventArgs sendGiftEventArgs: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(sendGiftEventArgs.GiftName.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && sendGiftEventArgs.GiftName.Contains(word))) { return; } diff --git a/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs b/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs index 7c567c69..fb440405 100644 --- a/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs +++ b/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs @@ -73,7 +73,7 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess case DanmuMessageEventArgs Danmu: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(Danmu.Message.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && Danmu.Message.Contains(word))) { return; } @@ -98,7 +98,7 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess case SendGiftEventArgs sendGiftEventArgs: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(sendGiftEventArgs.GiftName.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && sendGiftEventArgs.GiftName.Contains(word))) { return; } diff --git a/Desktop/Views/Windows/VlcPlayWindow.xaml.cs b/Desktop/Views/Windows/VlcPlayWindow.xaml.cs index b491fa2e..731cf960 100644 --- a/Desktop/Views/Windows/VlcPlayWindow.xaml.cs +++ b/Desktop/Views/Windows/VlcPlayWindow.xaml.cs @@ -252,7 +252,7 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess case DanmuMessageEventArgs Danmu: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(Danmu.Message.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && Danmu.Message.Contains(word))) { return; }