#pragma warning restore 0414 /// <summary> /// Function that builds the contents of the generated file based on the contents of the input file /// </summary> /// <param name="inputFileContent">Content of the input file</param> /// <returns>Generated file as a byte array</returns> protected override byte[] GenerateCode(string inputFileContent) { var args = new ClassGeneratorArgs() { Namespace = this.FileNameSpace, Dtml = XDocument.Parse(inputFileContent), Provider = this.GetCodeProvider() }; var builder = new ClassGenerator(args); //this.GetVSProject().References.Add("umbraco.Linq.Core"); //this.GetVSProject().References.Add("System.Core"); //this.GetVSProject().References.Add("umbraco"); builder.GenerateCode(); return builder.SaveForVs(); }
#pragma warning restore 0414 /// <summary> /// Function that builds the contents of the generated file based on the contents of the input file /// </summary> /// <param name="inputFileContent">Content of the input file</param> /// <returns>Generated file as a byte array</returns> protected override byte[] GenerateCode(string inputFileContent) { var args = new ClassGeneratorArgs() { Namespace = this.FileNameSpace, Dtml = XDocument.Parse(inputFileContent), Provider = this.GetCodeProvider() }; var builder = new ClassGenerator(args); //this.GetVSProject().References.Add("umbraco.Linq.Core"); //this.GetVSProject().References.Add("System.Core"); //this.GetVSProject().References.Add("umbraco"); builder.GenerateCode(); return(builder.SaveForVs()); }
/// <summary> /// Creates a new CodeBuilder. /// </summary> /// <param name="xmlPath">The path to the DTML file</param> /// <param name="lang">The language to generate with.</param> /// <returns></returns> public static ClassGenerator CreateBuilder(string xmlPath, string ns, GenerationLanguage lang) { var args = new ClassGeneratorArgs() { DtmlPath = xmlPath, Namespace = ns, }; switch (lang) { case GenerationLanguage.VB: args.Provider = new VBCodeProvider(); break; case GenerationLanguage.CSharp: default: args.Provider = new CSharpCodeProvider(); break; } return new ClassGenerator(args); }
/// <summary> /// Creates a new CodeBuilder. /// </summary> /// <param name="xmlPath">The path to the DTML file</param> /// <param name="lang">The language to generate with.</param> /// <returns></returns> public static ClassGenerator CreateBuilder(string xmlPath, string ns, GenerationLanguage lang) { var args = new ClassGeneratorArgs() { DtmlPath = xmlPath, Namespace = ns, }; switch (lang) { case GenerationLanguage.VB: args.Provider = new VBCodeProvider(); break; case GenerationLanguage.CSharp: default: args.Provider = new CSharpCodeProvider(); break; } return(new ClassGenerator(args)); }
public static ClassGenerator CreateBuilder(string ns, GenerationLanguage lang, XDocument dtml, bool isInterface, bool interfaceInheritance) { var args = new ClassGeneratorArgs() { Dtml = dtml, Namespace = ns, IsInterface = isInterface, GenerateInterfaceInheritance = interfaceInheritance }; switch (lang) { case GenerationLanguage.VB: args.Provider = new VBCodeProvider(); break; case GenerationLanguage.CSharp: default: args.Provider = new CSharpCodeProvider(); break; } return(new ClassGenerator(args)); }
internal ClassGenerator(ClassGeneratorArgs args) { this.Args = args; }
internal ClassGenerator(ClassGeneratorArgs args) { this.Args = args; }
public static ClassGenerator CreateBuilder(string ns, GenerationLanguage lang, XDocument dtml, bool isInterface, bool interfaceInheritance) { var args = new ClassGeneratorArgs() { Dtml = dtml, Namespace = ns, IsInterface = isInterface, GenerateInterfaceInheritance = interfaceInheritance }; switch (lang) { case GenerationLanguage.VB: args.Provider = new VBCodeProvider(); break; case GenerationLanguage.CSharp: default: args.Provider = new CSharpCodeProvider(); break; } return new ClassGenerator(args); }