Reorganize the C# plugin code