Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var arguments = new CommandLineArgumentParser(args);
            CleanOutputDirectory(arguments);

            var models = ModelGenerator.Generate(arguments);
            ControllerGenerator.Generate(models, arguments);
        }
Ejemplo n.º 2
0
        internal static void CleanOutputDirectory(CommandLineArgumentParser arguments)
        {
            var directory = new DirectoryInfo(arguments.GetOutputPath());
            foreach (var file in directory.GetFiles())
            {
                file.Delete();
            }

            foreach (var subDirectory in directory.GetDirectories())
            {
                subDirectory.Delete(true);
            }
        }
Ejemplo n.º 3
0
        internal static IReadOnlyList<TypeScriptClass> Generate(CommandLineArgumentParser arguments)
        {
            var sourceFileProcessors = SourceFileProcessor.GetSourceFileProcessors(arguments.GetSourcePath(), typeof(GeneratedModel));

            var models = GetModels(sourceFileProcessors);
            if (models.Any())
            {
                FileGenerationHelper.CreateDirectoryIfNecessary(arguments.GetOutputPath(), ModelsDirectoryName);
            }

            RenderClassFiles(arguments.GetOutputPath(), models);

            return models;
        }