public static UsingTemplate AddUsing(this ClassTemplate classTemplate, string type, string path) { UsingTemplate usingTemplate = new UsingTemplate(null, type, path); classTemplate.Usings.Add(usingTemplate); return(usingTemplate); }
public static UsingTemplate AddUsing(this ClassTemplate classTemplate, string nameSpace) { UsingTemplate usingTemplate = new UsingTemplate(nameSpace, null, null); classTemplate.Usings.Add(usingTemplate); return(usingTemplate); }
public virtual void Write(ICodeFragment fragment, IOutputCache output) { UsingTemplate template = (UsingTemplate)fragment; if (template is UnknownExportTemplate unknownUsing) { output.Add(unknownUsing.Code).BreakLine(); return; } if (template.Path == null || template.Type == null) { Logger.Error("Invalid TypeScript import/export (path or type is missing)"); return; } string action = template is ExportTemplate ? "export" : "import"; string typeName = template.Type; if (!typeName.StartsWith("*")) { typeName = $"{{ {typeName} }}"; } output.Add($"{action} {typeName} from ") .Add(this.options.Formatting.Quote) .Add(template.Path.TrimEnd(".ts")) .Add(this.options.Formatting.Quote) .CloseLine(); }
public NatashaAssemblyDomain(string key) : base(key) { UseNewVersionAssmebly = true; #if !NETSTANDARD2_0 DependencyResolver = new AssemblyDependencyResolver(AppDomain.CurrentDomain.BaseDirectory); #endif _usingsTemplate = new UsingTemplate(); AddAssemblyEvent += NatashaAssemblyDomain_AddAssemblyEvent;; RemoveAssemblyEvent += NatashaAssemblyDomain_RemoveAssemblyEvent;; }
public virtual void Write(ICodeFragment fragment, IOutputCache output) { UsingTemplate template = (UsingTemplate)fragment; string typeName = template.Type; if (!typeName.StartsWith("*")) { typeName = $"{{ {typeName} }}"; } output.Add($"import {typeName} from \"{template.Path.TrimEnd(".ts")}\"").CloseLine(); }
public static ClassTemplate WithUsing(this ClassTemplate classTemplate, UsingTemplate usingTemplate) { classTemplate.Usings.Add(usingTemplate); return(classTemplate); }
public static UsingTemplate AddUsing(this ClassTemplate classTemplate, UsingTemplate usingTemplate) { classTemplate.Usings.Add(usingTemplate); return(usingTemplate); }
public static FileTemplate WithUsing(this FileTemplate fileTemplate, UsingTemplate usingTemplate) { fileTemplate.Usings.Add(usingTemplate); return(fileTemplate); }
public static UsingTemplate AddUsing(this FileTemplate fileTemplate, UsingTemplate usingTemplate) { fileTemplate.Usings.Add(usingTemplate); return(usingTemplate); }
public virtual void Write(ICodeFragment fragment, IOutputCache output) { UsingTemplate template = (UsingTemplate)fragment; output.Add($"using {template.Namespace}").CloseLine(); }