Example #1
0
        public static string GenerateFile(FileDeclaration fileDeclaration)
        {
            StringBuilder sb = new StringBuilder();

            Append(sb, fileDeclaration);
            return(sb.ToString());
        }
Example #2
0
        private static void Append(StringBuilder sb, FileDeclaration fileDeclaration)
        {
            Append(sb, fileDeclaration.UsingDeclarations);

            if (fileDeclaration.HasNamespaceDeclaration())
            {
                sb.AppendLine(C.NAMESPACE + C.SPACE + fileDeclaration.NamespaceDeclaration.Name);
                sb.AppendLine(C.OPEN_CURLY_BRACKET);
            }

            if (fileDeclaration.HasClassDeclaration())
            {
                Append(sb, fileDeclaration.ClassDeclaration);
            }

            if (fileDeclaration.HasNamespaceDeclaration())
            {
                sb.AppendLine(C.CLOSE_CURLY_BRACKET);
            }
        }