private static void AddAttributes(TypeScriptCodeBuilder codeBuilder, List <MetadataAttribute> attributes, int start) { foreach (var attribute in attributes) { var declaration = new List <string> { string.Format("@{0}", attribute.Name), "(" }; if (attribute.Sets.Count > 0) { if (attribute.HasMembers) { declaration.Add("{"); codeBuilder.Lines.Add(new CodeLine(string.Join("", declaration))); for (var i = 0; i < attribute.Sets.Count; i++) { var set = attribute.Sets[i]; codeBuilder.Lines.Add(new CodeLine("{0}{1}: {2}{3}", codeBuilder.Indent(start + 1), set.Name, set.Value, i < attribute.Sets.Count - 1 ? "," : string.Empty)); } } codeBuilder.Lines.Add(new CodeLine("})")); } } }
private static void AddAttributes(TypeScriptCodeBuilder codeBuilder, List <MetadataAttribute> attributes, StringBuilder output, Int32 start) { foreach (var attribute in attributes) { output.AppendFormat("@{0}", attribute.Name); output.Append("("); if (attribute.Sets.Count > 0) { if (attribute.HasMembers) { output.Append("{"); output.AppendLine(); for (var i = 0; i < attribute.Sets.Count; i++) { var set = attribute.Sets[i]; output.AppendFormat("{0}{1}: {2}", codeBuilder.Indent(start + 1), set.Name, set.Value); if (i < attribute.Sets.Count - 1) { output.Append(","); output.AppendLine(); } } output.AppendLine(); } output.Append("}"); } output.Append(")"); output.AppendLine(); } }