I was wandering, if I have code like this in some DLL:
public class DemoClass
{
public void TestAction(XMParams command)
{
var firstName = command.Parse<string>(Params.First, "First Name");
var lastName = command.Parse<string>(Params.Second, "Last Name");
var userData = new UserDataDto{
FirstName = firstName,
LastName = lastName
}
command.StoreValue(userData, "User Data");
}
}
Is it posible to detect these lines where command.Parse is used, and to extract these data: command.Parse<Type>(Index, Description)
and
command.StoreValue(Type, DescriptiveName);
Into this the list of objects which looks like this one:
public class InputParamObj
{
public int Index {get;set;}
public string Type {get;set;}
public string Description {get;set;}
}
public class OutputObj
{
public string Type {get;set;}
public string Description {get;set;}
}
public class CommandData
{
public List<InputParamObj> InputParams {get;set;}
public OutputObj Output {get;set;}
}
Note, this piece of code will always be in known method for example inside the "TestAction" method.