public int GetBuildDefinitions()

in src/VstsDemoBuilder/Services/ExtractorService.cs [767:848]


        public int GetBuildDefinitions(ProjectConfigurations appConfig)
        {
            try
            {
                BuildandReleaseDefs buildandReleaseDefs = new BuildandReleaseDefs(appConfig.BuildDefinitionConfig);
                List<JObject> builds = buildandReleaseDefs.ExportBuildDefinitions();
                BuildandReleaseDefs repoDefs = new BuildandReleaseDefs(appConfig.RepoConfig);
                Dictionary<string, string> variableGroupNameId = GetVariableGroups(appConfig);
                RepositoryList.Repository repo = repoDefs.GetRepoList();
                if (builds.Count > 0)
                {
                    int count = 1;
                    //creating ImportCode Json file
                    string templatePath = extractedTemplatePath + appConfig.BuildDefinitionConfig.Project;
                    foreach (JObject def in builds)
                    {
                        string repoID = "";
                        var buildName = def["name"];
                        string fileName = buildName.ToString().Replace(".", "") + ".json";
                        var repoName = def["repository"]["name"];
                        var type = def["repository"]["type"];
                        foreach (var re in repo.value)
                        {
                            if (re.name == repoName.ToString())
                            {
                                repoID = re.id;
                            }
                        }
                        def["authoredBy"] = "{}";
                        def["project"] = "{}";
                        def["url"] = "";
                        def["uri"] = "";
                        def["id"] = "";
                        if (def["queue"]["pool"].HasValues)
                        {
                            def["queue"]["pool"]["id"] = "";
                        }
                        def["_links"] = "{}";
                        def["createdDate"] = "";
                        if (def["variableGroups"] != null)
                        {
                            var variableGroup = def["variableGroups"].HasValues ? def["variableGroups"].ToArray() : new JToken[0];
                            if (variableGroup.Length > 0)
                            {
                                foreach (var groupId in variableGroup)
                                {
                                    groupId["id"] = "$" + variableGroupNameId.Where(x => x.Key == groupId["id"].ToString()).FirstOrDefault().Value + "$";
                                }
                            }
                        }
                        var yamalfilename = def["process"]["yamlFilename"];

                        #region YML PIPELINES OF TYPE AZURE REPOS
                        if (yamalfilename != null && type.ToString().ToLower() == "tfsgit")
                        {
                            count = YmlWithAzureRepos(appConfig, count, templatePath, def, fileName, type);
                        }
                        #endregion

                        #region YML PIPELINE WITH GITHUB
                        else if (yamalfilename != null && type.ToString().ToLower() == "github")
                        {
                            count = YmlWithGitHub(appConfig, count, templatePath, def, fileName, type);
                        }
                        #endregion

                        #region OTHER
                        else if (yamalfilename == null)
                        {
                            count = NormalPipeline(appConfig, count, templatePath, def, fileName, repoName, type);
                        }
                        #endregion
                    }
                    return count;
                }
            }
            catch (Exception ex)
            {
                logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\n" + ex.StackTrace + "\n");
            }
            return 0;
        }