public static Task PrintType(JabberCompiler.Model.IReadOnlyType typeData) { FullFile fullFile = Composer.CreateFileForType(typeData); PrinterBuilder builder = new PrinterBuilder(); string fileContents = builder.PrintFullFile(fullFile); return PrintToFile(fullFile.Name, fileContents); }
internal static FullFile CreateFileForType(JabberCompiler.Model.IReadOnlyType type) { if (type.IsSingleton) throw new NotImplementedException(); string fileName = System.IO.Path.ChangeExtension(type.Name, "cs"); FullFile file = new FullFile() { Name = fileName, Usings = UsingStatement.DefaultUsings }; Namespace nspace = GetNamespace(DEFAULT_PROJECT_NAME); file.NamespaceContained = nspace; nspace.InnerClass = type; return file; }