diff --git a/Codecepticon/Codecepticon.csproj b/Codecepticon/Codecepticon.csproj
index 9aa3488..c4de6db 100644
--- a/Codecepticon/Codecepticon.csproj
+++ b/Codecepticon/Codecepticon.csproj
@@ -9,7 +9,7 @@
9.0
Codecepticon
Codecepticon
- 1.0.1
+ 1.0.2
Pavel Tsakalidis
Accenture Security
Codecepticon
diff --git a/Codecepticon/Modules/CSharp/DataCollector.cs b/Codecepticon/Modules/CSharp/DataCollector.cs
index a6ed004..7f02def 100644
--- a/Codecepticon/Modules/CSharp/DataCollector.cs
+++ b/Codecepticon/Modules/CSharp/DataCollector.cs
@@ -282,6 +282,18 @@ public static async Task CollectFunctions(Solution solution, string projectName,
}
AllFunctions.Add(name);
}
+
+ // Also collect Delegate function declarations.
+ var delegateMethods = syntaxTree.GetRoot().DescendantNodes().OfType();
+ foreach (var m in delegateMethods)
+ {
+ string name = m.Identifier.ToString();
+ if (AllFunctions.Contains(name))
+ {
+ continue;
+ }
+ AllFunctions.Add(name);
+ }
}
public static async Task FilterCollectedData()
diff --git a/Codecepticon/Modules/CSharp/DataRenamer.cs b/Codecepticon/Modules/CSharp/DataRenamer.cs
index f965a6a..d36327e 100644
--- a/Codecepticon/Modules/CSharp/DataRenamer.cs
+++ b/Codecepticon/Modules/CSharp/DataRenamer.cs
@@ -110,6 +110,21 @@ public async Task RenameFunctions(Solution solution, string projectNam
solution = await RenameCode(solution, projectName, documentName, name, DataCollector.Mapping.Functions[name]);
}
+ // Rename delegates.
+ var delegateMethods = syntaxTree.GetRoot().DescendantNodes().OfType();
+ foreach(var m in delegateMethods)
+ {
+ string name = m.Identifier.ToString();
+ if (!DataCollector.Mapping.Functions.ContainsKey(name))
+ {
+ Logger.Debug($"Delegate Function does not exist in mapping: {name}");
+
+ continue;
+ }
+
+ solution = await RenameCode(solution, projectName, documentName, name, DataCollector.Mapping.Functions[name]);
+ }
+
return solution;
}
diff --git a/Codecepticon/Modules/CSharp/SyntaxTreeHelper.cs b/Codecepticon/Modules/CSharp/SyntaxTreeHelper.cs
index 6765d03..95b6940 100644
--- a/Codecepticon/Modules/CSharp/SyntaxTreeHelper.cs
+++ b/Codecepticon/Modules/CSharp/SyntaxTreeHelper.cs
@@ -215,6 +215,10 @@ public async Task RenameCode(Solution solution, string projectName,
{
node = ((IEnumerable)nodes).FirstOrDefault(s => s.Identifier.ToString() == existingName);
}
+ else if (typeof(T) == typeof(DelegateDeclarationSyntax))
+ {
+ node = ((IEnumerable)nodes).FirstOrDefault(s => s.Identifier.ToString() == existingName);
+ }
else if (typeof(T) == typeof(MethodDeclarationSyntax))
{
node = ((IEnumerable)nodes).FirstOrDefault(s => s.Identifier.ToString() == existingName);
diff --git a/Codecepticon/Properties/launchSettings.json b/Codecepticon/Properties/launchSettings.json
index 1f47cdc..352fdf7 100644
--- a/Codecepticon/Properties/launchSettings.json
+++ b/Codecepticon/Properties/launchSettings.json
@@ -1,8 +1,7 @@
{
"profiles": {
"Codecepticon": {
- "commandName": "Project",
- "commandLineArgs": "--config C:\\data\\tmp\\seatbelt.xml"
+ "commandName": "Project"
}
}
}
\ No newline at end of file