Ejemplo n.º 1
0
 public virtual string Format(TsModule module)
 {
     using (var sbc = new StringBuilderContext(this))
     {
         this.WriteIndent();
         this.Write("module {0} {{", Format(module.Name));
         this.WriteNewline();
         using (Indent())
         {
             foreach (var type in module.Types.OfType<TsEnum>())
                 this.Write(this.Format(type));
             foreach (var type in module.Types.OfType<TsInterface>())
                 this.Write(this.Format(type));
         }
         this.WriteIndent();
         this.Write("}");
         this.WriteNewline();
         return sbc.ToString();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Formats a module
 /// </summary>
 /// <param name="module">The module</param>
 /// <returns>The string representation of the module</returns>
 public virtual string Format(TsModule module)
 {
     using (var sbc = new StringBuilderContext(this))
     {
         this.WriteIndent();
         this.Write("declare module {0} {{", Format(module.Name));
         this.WriteNewline();
         using (Indent())
         {
             foreach (var type in module.Types.OfType <TsEnum>().OrderBy(x => x.Name))
             {
                 this.Write(this.Format(type));
             }
             foreach (var type in module.Types.OfType <TsInterface>().OrderBy(x => x.Name))
             {
                 this.Write(this.Format(type));
             }
         }
         this.WriteIndent();
         this.Write("}");
         this.WriteNewline();
         return(sbc.ToString());
     }
 }