public override void Run(DashboardInfo_Widget1 widget, AppConfig appConfig) { if (widget.settings == null) { WriteWarning("Skipped: settings == null"); return; } var settings = JsonConvert.DeserializeObject <CodeScalarWidgetSettings>(widget.settings); if (_sourceRepositoryList == null) { _sourceRepositoryList = TfsStatic.GetGitRepos(true); } if (_targetRepositoryList == null) { _targetRepositoryList = TfsStatic.GetGitRepos(false); } var sourceRepo = _sourceRepositoryList.value.FirstOrDefault(o => o.id == settings.repositoryId); var sourceRepoName = sourceRepo?.name; if (string.IsNullOrEmpty(sourceRepoName)) { WriteWarning($"Skipped: Can't find a repository in the source project with an id of '{settings.repositoryId}'."); return; } var targetRepoName = sourceRepoName; if (appConfig.Repos.Mapping.Keys.Any(o => o.Equals(targetRepoName, StringComparison.InvariantCultureIgnoreCase))) { targetRepoName = appConfig.Builds.Mapping[appConfig.Repos.Mapping.Keys.First(o => o.Equals(targetRepoName, StringComparison.InvariantCultureIgnoreCase))]; } var targetRepoId = _targetRepositoryList.value.FirstOrDefault(o => o.name == sourceRepoName)?.id; if (string.IsNullOrEmpty(targetRepoId)) { WriteWarning($"Skipped: Can't find a repository in the target project with the name of '{sourceRepoName}'."); return; } settings.repositoryId = targetRepoId; widget.settings = JsonConvert.SerializeObject(settings); }
GetInformationLabelText(repositories, MobileSortingService.GetSortingCategory(mobileSortingService.CurrentOption));