Exemplo n.º 1
0
        private static string CreateDependencyName(string dependency)
        {
            var strings = dependency.Split('.');
            var name    = NameResolver.ToPascalCase(strings.Last());

            return(name);
        }
Exemplo n.º 2
0
        public void Init(string inputFileName, string fileName)
        {
            _fileName = fileName;
            className = NameResolver.ToPascalCase(Path.GetFileNameWithoutExtension(inputFileName));
            _scopes   = new List <Scope>
            {
                new Scope()
            };

            _dependencies     = new HashSet <string>();
            _dependenciesDict = new Dictionary <string, string>();

            fileGen = new FileGen(_fileName);

            typeGen = fileGen.Class();

            codeGen = typeGen.GetCodeGen();
        }
Exemplo n.º 3
0
        public void Convert()
        {
            foreach (string file in Directory.EnumerateFiles(_startPath, "*.lua", SearchOption.AllDirectories))
            {
                var relativePath = PathHelper.MakeRelativePath(_startPath, file);
                Console.WriteLine(relativePath);
                var relativeDir = Path.GetDirectoryName(relativePath);
                var outputDir   = Path.Combine(_outPath, relativeDir);
                var outputFile  = Path.Combine(outputDir,
                                               NameResolver.ToPascalCase(Path.GetFileNameWithoutExtension(file)) + ".cs");

                Directory.CreateDirectory(outputDir);
                Console.WriteLine(outputFile);

                var fileConverter = new FileConverter(file, outputFile);
                fileConverter.Convert();
                if (!string.IsNullOrEmpty(fileConverter.CompilationErrorMessage))
                {
                    Console.WriteLine(fileConverter.CompilationErrorMessage);
                }
            }
        }