Exemplo n.º 1
0
        static int Main(string[] args)
        {
            return(0);

            BuildProgram  build    = new BuildProgram();
            DirectoryInfo root     = build.GetStartLocation();
            DirectoryInfo solution = build.GetSolutionRoot();

            FileInfo genericGameInfo = solution.GetFile("GenericContext.cs", SearchOption.AllDirectories);

            CSharpToTypescriptConverter converter = new CSharpToTypescriptConverter();

            Settings settings = new Settings();
            //settings.IsConvertToInterface = true;

            string typeScript = converter.ConvertToTypescript(File.ReadAllText(genericGameInfo.FullName), settings);

            if (string.IsNullOrEmpty(typeScript))
            {
                return(1);
            }
            else
            {
                string dest = Path.Combine(root.FullName, "index.d.ts");
                if (File.Exists(dest))
                {
                    File.Delete(dest);
                }
                File.WriteAllText(dest, typeScript);
            }

            return(0);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            var cScript = @"class Foo{}";
            CSharpToTypescriptConverter csharpToTypescriptConverter = new CSharpToTypescriptConverter();
            var typescript = csharpToTypescriptConverter.ConvertToTypescript(cScript);

            System.Console.WriteLine(typescript);
        }