mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 20:24:16 +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>
|
/// </summary>
|
||||||
public partial class FileDialog
|
public partial class FileDialog
|
||||||
{
|
{
|
||||||
private static Regex filterRegex = new(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled);
|
|
||||||
|
|
||||||
private List<FilterStruct> filters = [];
|
private List<FilterStruct> filters = [];
|
||||||
private FilterStruct selectedFilter;
|
private FilterStruct selectedFilter;
|
||||||
|
|
||||||
|
[GeneratedRegex(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled)]
|
||||||
|
private static partial Regex FilterRegex();
|
||||||
|
|
||||||
private void ParseFilters(string filters)
|
private void ParseFilters(string filters)
|
||||||
{
|
{
|
||||||
// ".*,.cpp,.h,.hpp"
|
// ".*,.cpp,.h,.hpp"
|
||||||
|
|
@ -22,7 +23,7 @@ public partial class FileDialog
|
||||||
if (filters.Length == 0) return;
|
if (filters.Length == 0) return;
|
||||||
|
|
||||||
var currentFilterFound = false;
|
var currentFilterFound = false;
|
||||||
var matches = filterRegex.Matches(filters);
|
var matches = FilterRegex().Matches(filters);
|
||||||
foreach (Match m in matches)
|
foreach (Match m in matches)
|
||||||
{
|
{
|
||||||
var match = m.Value;
|
var match = m.Value;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Dalamud.Plugin.Internal.Profiles;
|
||||||
/// Class responsible for managing plugin profiles.
|
/// Class responsible for managing plugin profiles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ServiceManager.BlockingEarlyLoadedService($"Data provider for {nameof(PluginManager)}.")]
|
[ServiceManager.BlockingEarlyLoadedService($"Data provider for {nameof(PluginManager)}.")]
|
||||||
internal class ProfileManager : IServiceType
|
internal partial class ProfileManager : IServiceType
|
||||||
{
|
{
|
||||||
private static readonly ModuleLog Log = new("PROFMAN");
|
private static readonly ModuleLog Log = new("PROFMAN");
|
||||||
private readonly DalamudConfiguration config;
|
private readonly DalamudConfiguration config;
|
||||||
|
|
@ -334,12 +334,15 @@ internal class ProfileManager : IServiceType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GeneratedRegex(@" \(.* Mix\)")]
|
||||||
|
private static partial Regex MixRegex();
|
||||||
|
|
||||||
private string GenerateUniqueProfileName(string startingWith)
|
private string GenerateUniqueProfileName(string startingWith)
|
||||||
{
|
{
|
||||||
if (this.profiles.All(x => x.Name != startingWith))
|
if (this.profiles.All(x => x.Name != startingWith))
|
||||||
return startingWith;
|
return startingWith;
|
||||||
|
|
||||||
startingWith = Regex.Replace(startingWith, @" \(.* Mix\)", string.Empty);
|
startingWith = MixRegex().Replace(startingWith, string.Empty);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue