示例#1
0
        public static void Main(string[] args)
        {
            var arguments = new CommandLineArgumentParser(args);
            CleanOutputDirectory(arguments);

            var models = ModelGenerator.Generate(arguments);
            ControllerGenerator.Generate(models, arguments);
        }
示例#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);
            }
        }
示例#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;
        }