Exemplo n.º 1
0
        private void ConvertFiles()
        {
            var files   = Directory.GetFiles(_inputPath, "*.cs");
            var cache   = new ClassDefinitionCache();
            var classes = new Dictionary <string, ClassDefinition>();

            Console.WriteLine($"Total {files.Length} files to create");
            Console.WriteLine("Reading class meta data");

            foreach (var file in files)
            {
                var stream  = File.OpenRead(file);
                var reader  = new StreamReader(stream);
                var content = reader.ReadToEnd();

                var tree = CSharpSyntaxTree.ParseText(content);

                tree.TryGetRoot(out var root);

                var visitor = new ClassDefinitionWalker(cache);
                visitor.Visit(root);

                visitor.Collection.ForEach(c => classes.Add(c.Name, c));
            }

            Console.WriteLine("Done parsing");
            Console.WriteLine("Creating files");

            foreach (var c in classes.Values)
            {
                CreateTsFile(classes, c);
            }

            Console.WriteLine("All files converted");
            Console.WriteLine("Press any to escape");
            Console.Read();
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            var config = "simavm.json".DeserializeFile <SimaVmConfig>();

            Directory.SetCurrentDirectory(config.startDir);

            if (!Directory.Exists(ConstStrings.CachedDir))
            {
                Directory.CreateDirectory(ConstStrings.CachedDir);
            }

            var classDefinitionCache = new ClassDefinitionCache();

            classDefinitionCache.GetClass("java.lang.Object");

            var classDefinition = classDefinitionCache.GetClass(config.startClass);

            var classes = TypeResolver.Instance.Classes.ToArray();

            foreach (var clazz in classes)
            {
                classDefinitionCache.GetClass(clazz.Name);
            }
        }
 public PropertyDeclarationVisitor(ClassDefinitionCache cache, ReferenceCollection reference)
 {
     Cache     = cache;
     Reference = reference;
 }
Exemplo n.º 4
0
 public TypeArgumentListWalker(ClassDefinitionCache cache, ReferenceCollection reference)
 {
     Cache     = cache;
     Reference = reference;
 }
 public ClassDefinitionVisitor(ClassDefinitionCache cache)
 {
     Cache = cache;
 }
Exemplo n.º 6
0
 public ConvertHelper(ClassDefinitionCache cache = null)
 {
     Cache = cache ?? new ClassDefinitionCache();
 }
 public ClassDefinitionWalker(ClassDefinitionCache cache)
 {
     Cache = cache;
 }