Exemplo n.º 1
0
        static File parseFile(string path)
        {
            string     source = System.IO.File.ReadAllText(path);
            SyntaxTree tree   = CSharpSyntaxTree.ParseText(source);
            var        root   = (CompilationUnitSyntax)tree.GetRoot();

            var modelCollector = new ModelCollector();
            var enumCollector  = new EnumCollector();

            modelCollector.Visit(root);
            enumCollector.Visit(root);

            return(new File()
            {
                FileName = System.IO.Path.GetFullPath(path),
                Models = modelCollector.Models,
                Enums = enumCollector.Enums
            });
        }
Exemplo n.º 2
0
        private static FileMetaInfo ParseFile(string path)
        {
            var source = File.ReadAllText(path);
            var tree   = CSharpSyntaxTree.ParseText(source);
            var root   = (CompilationUnitSyntax)tree.GetRoot();

            var modelCollector = new ModelCollector();
            var enumCollector  = new EnumCollector();

            modelCollector.Visit(root);
            enumCollector.Visit(root);

            return(new FileMetaInfo
            {
                FileName = Path.GetFullPath(path),
                Models = modelCollector.Models,
                Enums = enumCollector.Enums
            });
        }
Exemplo n.º 3
0
        static File parseFile(string path)
        {
            string     source = System.IO.File.ReadAllText(path);
            SyntaxTree tree   = CSharpSyntaxTree.ParseText(source);
            var        root   = (CompilationUnitSyntax)tree.GetRoot();

            var classCollector     = new ClassCollector();
            var enumCollector      = new EnumCollector();
            var interfaceCollector = new InterfaceCollector();

            classCollector.Visit(root);
            enumCollector.Visit(root);
            interfaceCollector.Visit(root);

            return(new File()
            {
                FileName = System.IO.Path.GetFullPath(path),
                Classes = classCollector.Items,
                Enums = enumCollector.Items,
                Interfaces = interfaceCollector.Items
            });
        }