Fixes not matching coding style

This commit is contained in:
tbrose 2021-12-07 01:38:37 +01:00
parent 39594b7362
commit f02e44d552
2 changed files with 3 additions and 2 deletions

View File

@ -7,7 +7,7 @@ using osu.Game.Online.Chat;
namespace osu.Game.Tests.Online.Chat namespace osu.Game.Tests.Online.Chat
{ {
[TestFixture] [TestFixture]
public class TestCheckUsername public class MessageNotifierTest
{ {
[Test] [Test]
public void TestContainsUsernameMidlinePositive() public void TestContainsUsernameMidlinePositive()

View File

@ -130,7 +130,8 @@ namespace osu.Game.Online.Chat
/// Checks if <paramref name="message"/> mentions <paramref name="username"/>. /// Checks if <paramref name="message"/> mentions <paramref name="username"/>.
/// This will match against the case where underscores are used instead of spaces (which is how osu-stable handles usernames with spaces). /// This will match against the case where underscores are used instead of spaces (which is how osu-stable handles usernames with spaces).
/// </summary> /// </summary>
public static bool checkContainsUsername(string message, string username) { public static bool checkContainsUsername(string message, string username)
{
string fullName = Regex.Escape(username); string fullName = Regex.Escape(username);
string underscoreName = Regex.Escape(username.Replace(' ', '_')); string underscoreName = Regex.Escape(username.Replace(' ', '_'));
return new Regex($"\\b({fullName}|{underscoreName})\\b", RegexOptions.IgnoreCase).Matches(message).Count > 0; return new Regex($"\\b({fullName}|{underscoreName})\\b", RegexOptions.IgnoreCase).Matches(message).Count > 0;