Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
-Escape html instead of removing it (so it still shows in chat)
-Fix clearchat/clearmsg functionality
  • Loading branch information
brian91292 committed Apr 6, 2019
1 parent 273d8c1 commit fb4b6b2
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 36 deletions.
16 changes: 7 additions & 9 deletions EnhancedStreamChat/Chat/ChatHandler.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CustomUI.Utilities;
using EnhancedStreamChat.Chat;
using EnhancedStreamChat.Chat;
using EnhancedStreamChat.Textures;
using EnhancedStreamChat.UI;
using System;
Expand Down Expand Up @@ -245,7 +244,7 @@ private void RegisterMessageHandlers()
if (twitchMsg.channelName != TwitchLoginConfig.Instance.TwitchChannelName)
return;

MessageParser.Parse(new ChatMessage(Utilities.StripHTML(twitchMsg.message), twitchMsg));
MessageParser.Parse(new ChatMessage(Utilities.EscapeHTML(twitchMsg.message), twitchMsg));
};

// USERNOTICE handler
Expand Down Expand Up @@ -303,7 +302,7 @@ private void RegisterMessageHandlers()
{
if (t.Groups["Tag"].Value == "target-user-id")
{
userId = t.Groups["target-user-id"].Value;
userId = t.Groups["Value"].Value;
break;
}
}
Expand All @@ -318,12 +317,11 @@ private void RegisterMessageHandlers()
{
if (t.Groups["Tag"].Value == "target-msg-id")
{
msgId = t.Groups["target-msg-id"].Value;
msgId = t.Groups["Value"].Value;
break;
}
}
if (msgId == String.Empty) return;

PurgeChatMessageById(msgId);
};
}
Expand All @@ -350,9 +348,9 @@ private void InitializeChatUI()
_lastFontName = ChatConfig.Instance.FontName;
StartCoroutine(Drawing.Initialize(gameObject.transform));

_lockedSprite = UIUtilities.LoadSpriteFromResources("EnhancedStreamChat.Resources.LockedIcon.png");
_lockedSprite = Utilities.LoadSpriteFromResources("EnhancedStreamChat.Resources.LockedIcon.png");
_lockedSprite.texture.wrapMode = TextureWrapMode.Clamp;
_unlockedSprite = UIUtilities.LoadSpriteFromResources("EnhancedStreamChat.Resources.UnlockedIcon.png");
_unlockedSprite = Utilities.LoadSpriteFromResources("EnhancedStreamChat.Resources.UnlockedIcon.png");
_unlockedSprite.texture.wrapMode = TextureWrapMode.Clamp;

_twitchChatCanvas = gameObject.AddComponent<Canvas>();
Expand Down Expand Up @@ -561,7 +559,7 @@ private void PurgeChatMessagesInternal(KeyValuePair<string, bool> messageInfo)
return;
else if (id != "!FULLCLEAR!" && !ChatConfig.Instance.ClearTimedOutMessages)
return;

bool purged = false;
foreach (CustomText currentMessage in _chatMessages)
{
Expand Down
12 changes: 5 additions & 7 deletions EnhancedStreamChat/EnhancedStreamChat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\..\steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\beatsaber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BeatSaberCustomUI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="BeatSaberCustomUI, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
</Reference>
<Reference Include="IllusionInjector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\..\beatsaber\Beat Saber_Data\Managed\IllusionInjector.dll</HintPath>
Expand Down
3 changes: 1 addition & 2 deletions EnhancedStreamChat/Images/AnimationDecoder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CustomUI.Utilities;
using EnhancedStreamChat.Images;
using EnhancedStreamChat.Images;
using EnhancedStreamChat.UI;
using System;
using System.Collections;
Expand Down
5 changes: 2 additions & 3 deletions EnhancedStreamChat/Images/ImageDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using EnhancedStreamChat.UI;
using StreamCore.SimpleJSON;
using System.Text.RegularExpressions;
using CustomUI.Utilities;
using EnhancedStreamChat.Config;
using StreamCore;
using EnhancedStreamChat.Images;
Expand Down Expand Up @@ -280,7 +279,7 @@ public static IEnumerator Download(string imagePath, TextureDownloadInfo imageDo
bool localPathExists = ImageExistsLocally(ref imagePath, imageDownloadInfo, out var localFilePath);
yield return Utilities.Download(imagePath, Utilities.DownloadType.Texture, null, (web) =>
{
sprite = UIUtilities.LoadSpriteFromTexture(DownloadHandlerTexture.GetContent(web));
sprite = Utilities.LoadSpriteFromTexture(DownloadHandlerTexture.GetContent(web));
if (sprite)
{
if (!localPathExists)
Expand All @@ -289,7 +288,7 @@ public static IEnumerator Download(string imagePath, TextureDownloadInfo imageDo
});
}
else
sprite = UIUtilities.LoadSpriteFromResources($"EnhancedStreamChat.Resources.Emojis.{imageDownloadInfo.spriteIndex.ToLower()}");
sprite = Utilities.LoadSpriteFromResources($"EnhancedStreamChat.Resources.Emojis.{imageDownloadInfo.spriteIndex.ToLower()}");

if (sprite)
{
Expand Down
5 changes: 1 addition & 4 deletions EnhancedStreamChat/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using EnhancedStreamChat.UI;
using System.Threading.Tasks;
using System.Collections;
using CustomUI.BeatSaber;
//using EnhancedTwitchChat.Bot;
using System.Runtime.CompilerServices;
using TMPro;
using EnhancedStreamChat.Config;
Expand All @@ -22,7 +20,7 @@ public class Plugin : IPlugin
{
public static readonly string ModuleName = "EnhancedStreamChat";
public string Name => ModuleName;
public string Version => "2.0.0";
public string Version => "2.0.1";

public static Plugin Instance { get; private set; }

Expand All @@ -40,7 +38,6 @@ public void OnApplicationStart()
{
if (Instance != null) return;
Instance = this;

ChatConfig = new ChatConfig();

TwitchWebSocketClient.Initialize();
Expand Down
4 changes: 2 additions & 2 deletions EnhancedStreamChat/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
4 changes: 2 additions & 2 deletions EnhancedStreamChat/UI/Drawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
using System.Collections;
using static POCs.Sanjay.SharpSnippets.Drawing.ColorExtensions;
using Random = System.Random;
using CustomUI.Utilities;
using System.Reflection;
using EnhancedStreamChat.Config;
using EnhancedStreamChat.Images;
using StreamCore;
using StreamCore.Chat;
using StreamCore.Utils;

namespace EnhancedStreamChat.UI
{
Expand Down Expand Up @@ -100,7 +100,7 @@ private static AssetBundle Assets
get
{
if(!_assets)
_assets = AssetBundle.LoadFromMemory(UIUtilities.GetResource(Assembly.GetExecutingAssembly(), "EnhancedStreamChat.Resources.Assets"));
_assets = AssetBundle.LoadFromMemory(Utilities.GetResource(Assembly.GetExecutingAssembly(), "EnhancedStreamChat.Resources.Assets"));
return _assets;
}
}
Expand Down
11 changes: 4 additions & 7 deletions EnhancedStreamChat/UI/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using CustomUI.MenuButton;
using CustomUI.Settings;
using CustomUI.Utilities;
using CustomUI.UIElements;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -15,6 +11,7 @@
//using EnhancedTwitchIntegration.Config;
using System.IO;
using StreamCore.Config;
using CustomUI.Settings;

namespace EnhancedStreamChat.UI
{
Expand Down Expand Up @@ -86,13 +83,13 @@ public static void OnLoad()
var messageSpacing = menu.AddSlider("Message Spacing", "The amount of vertical space between each message.", 0, 20, 2, true);
messageSpacing.SetValue += (spacing) => { ChatConfig.Instance.LineSpacing = spacing; };
messageSpacing.GetValue += () => { return (int)ChatConfig.Instance.LineSpacing; };

var textColor = menu.AddColorPicker("Text Color", "Choose the color of the menu text.", ChatConfig.Instance.TextColor);
textColor.SetValue += (texCol) => { ChatConfig.Instance.TextColor = texCol; };
textColor.GetValue += () => { return ChatConfig.Instance.TextColor; };

var backgroundColor = menu.AddColorPicker("Background Color", "Choose the color of the menu background.", ChatConfig.Instance.BackgroundColor);
backgroundColor.SetValue += (bgCol) => { ChatConfig.Instance.BackgroundColor = bgCol; };
backgroundColor.SetValue += (bgCol) => { ChatConfig.Instance.BackgroundColor = bgCol; };
backgroundColor.GetValue += () => { return ChatConfig.Instance.BackgroundColor; };
}
}
Expand Down

0 comments on commit fb4b6b2

Please sign in to comment.