Plug-Ins

Topics: Developer Forum
Feb 6, 2008 at 4:27 PM
Hi,

whats the state of the plug-in model implemented in CCCP?
Is there a sample for a custom plug-in?

Alex
Feb 12, 2008 at 3:12 PM
Hi,

I'm also looking for a documentation. I want to create a plugin which checks the parameters of a method for emptiness.
So I put a test-class in a dll, which I strongly signed and put that dll into GAC:

CheckCodeCommentsPlugin("CheckForEmptyCommentBody", "Checks if method-parameter-documentation is not empty.")
public class CheckForEmptyCommentBody : ICheckCodeCommentsPlugin
{
private ICheckCodeCommentsHost _objHost;

#region ICheckCodeCommentsPlugin Members

public void BeginCompilationUnitVerification(string sourceCode, IParser parser, NRefactoryASTConvertVisitor visitor)
{

}

public void EndCompilationUnitVerification()
{

}

public void Initialize(ICheckCodeCommentsHost host)
{
_objHost = host;
}

public CheckCodeCommentsVerificationState VerifyClass(IClass c)
{
return CheckCodeCommentsVerificationState.Pass;
}

public CheckCodeCommentsVerificationState VerifyEvent(IEvent e)
{
return CheckCodeCommentsVerificationState.Pass;
}

public CheckCodeCommentsVerificationState VerifyField(IField f)
{
return CheckCodeCommentsVerificationState.Pass;
}

public CheckCodeCommentsVerificationState VerifyProperty(IProperty p)
{
return CheckCodeCommentsVerificationState.Pass;
}

public CheckCodeCommentsVerificationState VerifyMethod(IMethod m)
{
_objHost.ReportError("Params found: " + ToCommaSeperatedString(m.Parameters));
_objHost.ReportError("Comment: " + m.Documentation);

return CheckCodeCommentsVerificationState.Pass;
}

#endregion

private static string ToCommaSeperatedString(IList<IParameter> objParameters)
{
StringBuilder objResult = new StringBuilder();

foreach (IParameter objParameter in objParameters)
{
objResult.Append(objParameter.Name + ", ");
}

return objResult.ToString().TrimEnd().TrimEnd(',');
}
}

When I now select my Assembly in the AssemblyList and press "ok" the Plugin is not listet in the Plugins-Listbox.
When I choose another DLL a messagebox states, that there is no valid Plugin in it.

Is the plugin-feature buggy or not fully implemented, or am I doing somethign wrong??
Feb 12, 2008 at 3:12 PM
Edited Feb 12, 2008 at 3:13 PM
^^ double post - sorry