mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fix SYSLIB1045: Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time.
This commit is contained in:
parent
d38aa63370
commit
28f63ad83e
2 changed files with 9 additions and 5 deletions
|
|
@ -8,11 +8,12 @@ namespace Dalamud.Interface.ImGuiFileDialog;
|
|||
/// </summary>
|
||||
public partial class FileDialog
|
||||
{
|
||||
private static Regex filterRegex = new(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled);
|
||||
|
||||
private List<FilterStruct> filters = [];
|
||||
private FilterStruct selectedFilter;
|
||||
|
||||
[GeneratedRegex(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled)]
|
||||
private static partial Regex FilterRegex();
|
||||
|
||||
private void ParseFilters(string filters)
|
||||
{
|
||||
// ".*,.cpp,.h,.hpp"
|
||||
|
|
@ -22,7 +23,7 @@ public partial class FileDialog
|
|||
if (filters.Length == 0) return;
|
||||
|
||||
var currentFilterFound = false;
|
||||
var matches = filterRegex.Matches(filters);
|
||||
var matches = FilterRegex().Matches(filters);
|
||||
foreach (Match m in matches)
|
||||
{
|
||||
var match = m.Value;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Dalamud.Plugin.Internal.Profiles;
|
|||
/// Class responsible for managing plugin profiles.
|
||||
/// </summary>
|
||||
[ServiceManager.BlockingEarlyLoadedService($"Data provider for {nameof(PluginManager)}.")]
|
||||
internal class ProfileManager : IServiceType
|
||||
internal partial class ProfileManager : IServiceType
|
||||
{
|
||||
private static readonly ModuleLog Log = new("PROFMAN");
|
||||
private readonly DalamudConfiguration config;
|
||||
|
|
@ -334,12 +334,15 @@ internal class ProfileManager : IServiceType
|
|||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex(@" \(.* Mix\)")]
|
||||
private static partial Regex MixRegex();
|
||||
|
||||
private string GenerateUniqueProfileName(string startingWith)
|
||||
{
|
||||
if (this.profiles.All(x => x.Name != startingWith))
|
||||
return startingWith;
|
||||
|
||||
startingWith = Regex.Replace(startingWith, @" \(.* Mix\)", string.Empty);
|
||||
startingWith = MixRegex().Replace(startingWith, string.Empty);
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue