code style

This commit is contained in:
Lightczx
2024-02-23 10:22:24 +08:00
parent fa9b39d134
commit c17798a8c9
2 changed files with 3 additions and 6 deletions

View File

@@ -86,7 +86,7 @@ internal sealed partial class AnnouncementService : IAnnouncementService
foreach (ref readonly Announcement item in CollectionsMarshal.AsSpan(listWrapper.List))
{
item.Subtitle = new StringBuilder(item.Subtitle).Replace("\r<br>", string.Empty).ToString();
item.Content = AnnouncementRegex.XmlTimeTagRegex.Replace(item.Content, x => x.Groups[1].Value);
item.Content = AnnouncementRegex.XmlTimeTagRegex().Replace(item.Content, x => x.Groups[1].Value);
}
}
}
@@ -133,7 +133,7 @@ internal sealed partial class AnnouncementService : IAnnouncementService
continue;
}
MatchCollection matches = AnnouncementRegex.XmlTimeTagRegex.Matches(announcement.Content);
MatchCollection matches = AnnouncementRegex.XmlTimeTagRegex().Matches(announcement.Content);
if (matches.Count < 2)
{
continue;

View File

@@ -22,9 +22,6 @@ internal static partial class AnnouncementRegex
/// <inheritdoc cref="SH.WebAnnouncementMatchPermanentActivityTime"/>
public static readonly Regex PermanentActivityAfterUpdateTimeRegex = new(SH.WebAnnouncementMatchPermanentActivityTime, RegexOptions.Compiled);
/// <inheritdoc cref="XmlTagRegex"/>
public static readonly Regex XmlTimeTagRegex = XmlTagRegex();
[GeneratedRegex("&lt;t class=\"t_(?:gl|lc)\".*?&gt;(.*?)&lt;/t&gt;", RegexOptions.Multiline)]
private static partial Regex XmlTagRegex();
public static partial Regex XmlTimeTagRegex();
}