Skip to content

Commit 0b3a8e0

Browse files
committed
Use Regex in namespace pattern
1 parent 2247dd1 commit 0b3a8e0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Confuser.Core/Project/Patterns/NamespaceFunction.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text.RegularExpressions;
23
using dnlib.DotNet;
34

45
namespace Confuser.Core.Project.Patterns {
@@ -22,7 +23,7 @@ public override int ArgumentCount {
2223
public override object Evaluate(IDnlibDef definition) {
2324
if (!(definition is TypeDef) && !(definition is IMemberDef))
2425
return false;
25-
object ns = Arguments[0].Evaluate(definition);
26+
var ns = Arguments[0].Evaluate(definition).ToString();
2627

2728
var type = definition as TypeDef;
2829
if (type == null)
@@ -31,7 +32,7 @@ public override object Evaluate(IDnlibDef definition) {
3132
while (type.IsNested)
3233
type = type.DeclaringType;
3334

34-
return type != null && type.Namespace == ns.ToString();
35+
return type != null && Regex.IsMatch(type.Namespace, ns);
3536
}
3637
}
3738
}

0 commit comments

Comments
 (0)