本文整理汇总了C#中ICodeGenerator.OfType方法的典型用法代码示例。如果您正苦于以下问题:C# ICodeGenerator.OfType方法的具体用法?C# ICodeGenerator.OfType怎么用?C# ICodeGenerator.OfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICodeGenerator
的用法示例。
在下文中一共展示了ICodeGenerator.OfType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public static CodeGenFile[] Generate(ICodeGeneratorDataProvider provider, string directory, ICodeGenerator[] codeGenerators)
{
directory = GetSafeDir(directory);
CleanDir(directory);
var generatedFiles = new List<CodeGenFile>();
foreach (var generator in codeGenerators.OfType<IPoolCodeGenerator>()) {
var files = generator.Generate(provider.poolNames);
generatedFiles.AddRange(files);
writeFiles(directory, files);
}
foreach (var generator in codeGenerators.OfType<IComponentCodeGenerator>()) {
var files = generator.Generate(provider.componentInfos);
generatedFiles.AddRange(files);
writeFiles(directory, files);
}
foreach (var generator in codeGenerators.OfType<IBlueprintsCodeGenerator>()) {
var files = generator.Generate(provider.blueprintNames);
generatedFiles.AddRange(files);
writeFiles(directory, files);
}
return generatedFiles.ToArray();
}
示例2: Generate
public static void Generate(ICodeGeneratorDataProvider provider, string directory, ICodeGenerator[] codeGenerators) {
directory = GetSafeDir(directory);
CleanDir(directory);
foreach (var generator in codeGenerators.OfType<IPoolCodeGenerator>()) {
writeFiles(directory, generator.Generate(provider.poolNames));
}
foreach (var generator in codeGenerators.OfType<IComponentCodeGenerator>()) {
writeFiles(directory, generator.Generate(provider.componentInfos));
}
}
示例3: Generate
public static void Generate(Type[] types, string[] poolNames, string dir, ICodeGenerator[] codeGenerators) {
dir = GetSafeDir(dir);
CleanDir(dir);
foreach (var generator in codeGenerators.OfType<IPoolCodeGenerator>()) {
writeFiles(dir, generator.Generate(poolNames));
}
var components = GetComponents(types);
foreach (var generator in codeGenerators.OfType<IComponentCodeGenerator>()) {
writeFiles(dir, generator.Generate(components));
}
var systems = GetSystems(types);
foreach (var generator in codeGenerators.OfType<ISystemCodeGenerator>()) {
writeFiles(dir, generator.Generate(systems));
}
}