|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Genuilder.Extensibility;
namespace InterfaceExtractor.Gen
{
public class DependencyHelloWorldPlugin : IPlugin
{
#region IPlugin Members
public void Initialize(ICodeRepository repository)
{
repository.CodeItemCreated += new CodeItemCreatedHandler(repository_CodeItemCreated);
}
void repository_CodeItemCreated(ICodeRepository sender, CodeItem item)
{
if(!item.Name.EndsWith("generated.cs"))
{
var dependency = item.SourceOf(item.Name + "generated.cs");
dependency.ShouldUpdateTarget += new CodeDependencyHandler(dependency_ShouldUpdateTarget);
}
}
void dependency_ShouldUpdateTarget(CodeDependency sender, CodeItem target)
{
target.Content = String.Format("public class {0}", ToClassName(sender.Source.Name)) + "{}";
}
private string ToClassName(string fileName)
{
return fileName
.Replace('.', '_')
.Replace('/', '_')
.Replace('\\', '_');
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am currently the CTO of
Metaco, we are leveraging the Bitcoin Blockchain for delivering financial services.
I also developed a tool to make IaaS on Azure more easy to use
IaaS Management Studio.
If you want to contact me, go
this way