string convert_type(string src) { if (lang == TargetLang.TypeScript) { if (src.StartsWith("Vpn")) { src = "VPN." + src; } if (src == "int" || src == "uint" || src == "long" || src == "ulong") { src = "number"; } if (src == "bool") { src = "boolean"; } if (src == "DateTime") { src = "Date"; } } return(src); }
string convert_function(string src) { if (lang == TargetLang.TypeScript) { if (src == "Console.WriteLine" || src == "print_object") { src = "console.log"; } if (src.StartsWith("api.") || src.StartsWith("Test_")) { src = "await " + src; } } return(src); }
public CodeGen() { csc = new CSharpCompiler("Test"); csc.AddReferenceDotNetStandard(); csc.AddReferenceByType(typeof(Newtonsoft.Json.JsonPropertyAttribute)); cs_types = new CSharpSourceCode(Path.Combine(CodeGenUtil.ProjectDir, @"VpnServerRpc\VPNServerRpcTypes.cs")); csc.AddSourceCode(cs_types); cs_stubs = new CSharpSourceCode(Path.Combine(CodeGenUtil.ProjectDir, @"VpnServerRpc\VPNServerRpc.cs")); csc.AddSourceCode(cs_stubs); cs_tests = new CSharpSourceCode(Path.Combine(CodeGenUtil.ProjectDir, @"VpnServerRpcTest\VpnServerRpcTest.cs")); csc.AddSourceCode(cs_tests); csc.Compile(); }
public CcWalker(CSharpSourceCode src, TargetLang lang) : base(SyntaxWalkerDepth.StructuredTrivia) { this.src = src; this.lang = lang; }
public void AddSourceCode(CSharpSourceCode cs) { this.SourceCodeList.Add(cs); }