Esempio n. 1
0
            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);
            }
Esempio n. 2
0
            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);
            }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public CcWalker(CSharpSourceCode src, TargetLang lang) : base(SyntaxWalkerDepth.StructuredTrivia)
 {
     this.src  = src;
     this.lang = lang;
 }
Esempio n. 5
0
 public void AddSourceCode(CSharpSourceCode cs)
 {
     this.SourceCodeList.Add(cs);
 }