/// <summary> /// Save C# codes into a file. /// </summary> public void Save() { var provider = new TypeScriptCodeProvider(jsOutput.AsModule); using (StreamWriter writer = new StreamWriter(jsOutput.JSPath)) { provider.GenerateCodeFromCompileUnit(TargetUnit, writer, TsCodeGenerationOptions.Instance); } }
/// <summary> /// Write CodeDOM into TS codes to TextWriter /// </summary> /// <param name="writer"></param> void WriteCode(TextWriter writer) { if (writer == null) { throw new ArgumentNullException(nameof(writer), "No TextWriter instance is defined."); } using TypeScriptCodeProvider provider = new TypeScriptCodeProvider(jsOutput.AsModule); provider.GenerateCodeFromCompileUnit(CodeCompileUnit, writer, TsCodeGenerationOptions.Instance); }