Exemple #1
0
        public static async Task <IEnumerable <object[]> > GetProjectTemplatesForSonarLintAsync()
        {
            List <object[]> result = new List <object[]>();

            await InitializeTemplatesAsync(new LocalTemplatesSource("SonarLint"));

            foreach (var platform in Platforms.GetAllPlatforms())
            {
                var templateProjectTypes = GenComposer.GetSupportedProjectTypes(platform);

                var projectTypes = GenContext.ToolBox.Repo.GetProjectTypes(platform)
                                   .Where(m => templateProjectTypes.Contains(m.Name) && !string.IsNullOrEmpty(m.Description))
                                   .Select(m => m.Name);

                foreach (var projectType in projectTypes)
                {
                    var projectFrameworks = GenComposer.GetSupportedFx(projectType, platform);

                    var targetFrameworks = GenContext.ToolBox.Repo.GetFrameworks(platform)
                                           .Where(m => projectFrameworks.Contains(m.Name))
                                           .Select(m => m.Name).ToList();

                    foreach (var framework in targetFrameworks)
                    {
                        result.Add(new object[] { projectType, framework, platform });
                    }
                }
            }

            return(result);
        }
Exemple #2
0
        protected static IEnumerable <object[]> GetAllProjectTemplates()
        {
            List <object[]> result = new List <object[]>();

            foreach (var language in ProgrammingLanguages.GetAllLanguages())
            {
                SetCurrentLanguage(language);

                foreach (var platform in Platforms.GetAllPlatforms())
                {
                    SetCurrentPlatform(platform);

                    var projectTypes = GenContext.ToolBox.Repo.GetProjectTypes(platform)
                                       .Where(m => !string.IsNullOrEmpty(m.Description))
                                       .Select(m => m.Name);

                    foreach (var projectType in projectTypes)
                    {
                        var targetFrameworks = GenContext.ToolBox.Repo.GetFrontEndFrameworks(platform, projectType)
                                               .Select(m => m.Name).ToList();

                        foreach (var framework in targetFrameworks)
                        {
                            result.Add(new object[] { projectType, framework, platform, language });
                        }
                    }
                }
            }

            return(result);
        }
Exemple #3
0
        public static IEnumerable <object[]> GetProjectTemplates(string frameworkFilter, string programmingLanguage, string selectedPlatform)
        {
            InitializeTemplates(new LocalTemplatesSource(ShortFrameworkName(frameworkFilter)));

            List <object[]> result = new List <object[]>();

            var languagesOfInterest = ProgrammingLanguages.GetAllLanguages().ToList();

            if (!string.IsNullOrWhiteSpace(programmingLanguage))
            {
                languagesOfInterest.Clear();
                languagesOfInterest.Add(programmingLanguage);
            }

            var platformsOfInterest = Platforms.GetAllPlatforms().ToList();

            if (!string.IsNullOrWhiteSpace(selectedPlatform))
            {
                platformsOfInterest.Clear();
                platformsOfInterest.Add(selectedPlatform);
            }

            foreach (var language in languagesOfInterest)
            {
                SetCurrentLanguage(language);
                foreach (var platform in platformsOfInterest)
                {
                    SetCurrentPlatform(platform);
                    var templateProjectTypes = GenComposer.GetSupportedProjectTypes(platform);

                    var projectTypes = GenContext.ToolBox.Repo.GetProjectTypes(platform)
                                       .Where(m => templateProjectTypes.Contains(m.Name) && !string.IsNullOrEmpty(m.Description))
                                       .Select(m => m.Name);

                    foreach (var projectType in projectTypes)
                    {
                        var projectFrameworks = GenComposer.GetSupportedFx(projectType, platform);

                        var targetFrameworks = GenContext.ToolBox.Repo.GetFrameworks(platform)
                                               .Where(m => projectFrameworks.Contains(m.Name) && m.Name == frameworkFilter)
                                               .Select(m => m.Name)
                                               .ToList();

                        foreach (var framework in targetFrameworks)
                        {
                            result.Add(new object[] { projectType, framework, platform, language });
                        }
                    }
                }
            }

            return(result);
        }
        protected static IEnumerable <object[]> GetPageAndFeatureTemplates(string frameworkFilter)
        {
            List <object[]> result = new List <object[]>();

            foreach (var language in ProgrammingLanguages.GetAllLanguages())
            {
                SetCurrentLanguage(language);
                foreach (var platform in Platforms.GetAllPlatforms())
                {
                    SetCurrentPlatform(platform);
                    var templateProjectTypes = GenComposer.GetSupportedProjectTypes(platform);

                    var projectTypes = GenContext.ToolBox.Repo.GetProjectTypes(platform)
                                       .Where(m => templateProjectTypes.Contains(m.Name) && !string.IsNullOrEmpty(m.Description))
                                       .Select(m => m.Name);

                    foreach (var projectType in projectTypes)
                    {
                        var projectFrameworks = GenComposer.GetSupportedFx(projectType, platform);

                        var targetFrameworks = GenContext.ToolBox.Repo.GetFrameworks(platform)
                                               .Where(m => projectFrameworks.Contains(m.Name) && m.Name == frameworkFilter)
                                               .Select(m => m.Name).ToList();

                        foreach (var framework in targetFrameworks)
                        {
                            var itemTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetFrameworkList().Contains(framework) &&
                                                                                       (t.GetTemplateType() == TemplateType.Page || t.GetTemplateType() == TemplateType.Feature) &&
                                                                                       t.GetPlatform() == platform &&
                                                                                       t.GetLanguage() == language &&
                                                                                       !t.GetIsHidden());

                            foreach (var itemTemplate in itemTemplates)
                            {
                                result.Add(new object[]
                                {
                                    itemTemplate.Name,
                                    projectType,
                                    framework,
                                    platform,
                                    itemTemplate.Identity,
                                    language,
                                });
                            }
                        }
                    }
                }
            }

            return(result);
        }
Exemple #5
0
        public static IEnumerable <object[]> GetProjectTemplates(string frameworkFilter, string programmingLanguage, string selectedPlatform)
        {
            InitializeTemplates(new LocalTemplatesSource(null, ShortFrameworkName(frameworkFilter)));

            List <object[]> result = new List <object[]>();

            var languagesOfInterest = ProgrammingLanguages.GetAllLanguages().ToList();

            if (!string.IsNullOrWhiteSpace(programmingLanguage))
            {
                languagesOfInterest.Clear();
                languagesOfInterest.Add(programmingLanguage);
            }

            var platformsOfInterest = Platforms.GetAllPlatforms().ToList();

            if (!string.IsNullOrWhiteSpace(selectedPlatform))
            {
                platformsOfInterest.Clear();
                platformsOfInterest.Add(selectedPlatform);
            }

            foreach (var language in languagesOfInterest)
            {
                SetCurrentLanguage(language);
                foreach (var platform in platformsOfInterest)
                {
                    SetCurrentPlatform(platform);

                    if (platform == Platforms.WinUI)
                    {
                        var appModels = AppModels.GetAllAppModels().ToList();
                        foreach (var appModel in appModels)
                        {
                            if (appModel == AppModels.Desktop)
                            {
                                result.AddRange(GetContextOptions(frameworkFilter, language, platform, appModel));
                            }
                        }
                    }
                    else
                    {
                        result.AddRange(GetContextOptions(frameworkFilter, language, platform, string.Empty));
                    }
                }
            }
            return(result);
        }
        public static IEnumerable <object[]> GetProjectTemplates()
        {
            InitializeTemplates(new LocalTemplatesSource("TestGen"));

            List <object[]> result = new List <object[]>();

            foreach (var language in ProgrammingLanguages.GetAllLanguages())
            {
                SetCurrentLanguage(language);

                foreach (var platform in Platforms.GetAllPlatforms())
                {
                    SetCurrentPlatform(platform);
                    var templateProjectTypes = GenComposer.GetSupportedProjectTypes(platform);

                    var projectTypes = GenContext.ToolBox.Repo.GetProjectTypes(platform)
                                       .Where(m => templateProjectTypes.Contains(m.Name) && !string.IsNullOrEmpty(m.Description))
                                       .Select(m => m.Name);

                    foreach (var projectType in projectTypes)
                    {
                        var projectFrameworks = GenComposer.GetSupportedFx(projectType, platform);

                        var targetFrameworks = GenContext.ToolBox.Repo.GetFrameworks(platform)
                                               .Where(m => projectFrameworks.Contains(m.Name))
                                               .Select(m => m.Name).ToList();

                        foreach (var framework in targetFrameworks)
                        {
                            result.Add(new object[] { projectType, framework, platform, language });
                        }
                    }
                }
            }

            return(result);
        }
Exemple #7
0
        public static IEnumerable <object[]> GetProjectTemplates(string frameworkFilter, string programmingLanguage, string selectedPlatform)
        {
            InitializeTemplates(new LocalTemplatesSource(null, ShortFrameworkName(frameworkFilter)));

            List <object[]> result = new List <object[]>();

            var languagesOfInterest = ProgrammingLanguages.GetAllLanguages().ToList();

            if (!string.IsNullOrWhiteSpace(programmingLanguage))
            {
                languagesOfInterest.Clear();
                languagesOfInterest.Add(programmingLanguage);
            }

            var platformsOfInterest = Platforms.GetAllPlatforms().ToList();

            if (!string.IsNullOrWhiteSpace(selectedPlatform))
            {
                platformsOfInterest.Clear();
                platformsOfInterest.Add(selectedPlatform);
            }

            foreach (var language in languagesOfInterest)
            {
                SetCurrentLanguage(language);
                foreach (var platform in platformsOfInterest)
                {
                    SetCurrentPlatform(platform);

                    var appModels = AppModels.GetAllAppModels().ToList();
                    foreach (var appModel in appModels)
                    {
                        var context = new UserSelectionContext(language, platform);

                        if (platform == Platforms.WinUI)
                        {
                            context.AddAppModel(appModel);
                        }

                        var projectTypes = GenContext.ToolBox.Repo.GetProjectTypes(context)
                                           .Where(m => !string.IsNullOrEmpty(m.Description))
                                           .Select(m => m.Name);



                        foreach (var projectType in projectTypes)
                        {
                            context.ProjectType = projectType;
                            var targetFrameworks = GenContext.ToolBox.Repo.GetFrontEndFrameworks(context)
                                                   .Where(m => m.Name == frameworkFilter)
                                                   .Select(m => m.Name)
                                                   .ToList();

                            foreach (var framework in targetFrameworks)
                            {
                                if (platform == Platforms.WinUI)
                                {
                                    result.Add(new object[] { projectType, framework, platform, language, appModel });
                                }
                                else
                                {
                                    result.Add(new object[] { projectType, framework, platform, language });
                                }
                            }
                        }
                    }
                }
            }

            return(result);
        }