예제 #1
0
        public static IEnumerable <DataModelIssue> LoadIssues(
            IEnumerable <string> fileNames,
            Config config,
            IssueKindFlags issueKind = IssueKindFlags.All)
        {
            IEnumerable <DataModelIssue> issues = new DataModelIssue[] {};

            if (fileNames == null)
            {
                return(issues);
            }

            foreach (string fileName in fileNames)
            {
                JsonSerializer serializer = new JsonSerializer();
                using (StreamReader sr = new StreamReader(fileName))
                    using (JsonReader reader = new JsonTextReader(sr))
                    {
                        issues = issues.Concat(serializer.Deserialize <List <DataModelIssue> >(reader)
                                               .Where(i => i.IsIssueKind(issueKind)));
                    }
            }

            // Process label/milestone aliases before repo filtering - its query might rely on the aliases
            foreach (DataModelIssue issue in issues)
            {
                issue.Labels = ApplyLabelAliases(issue.Labels, config.LabelAliasesMap).ToArray();
                ApplyMilestoneAliases(issue.Milestone, config.MilestoneAliasesMap);
            }

            // Process repo filters after label aliases, the filter query might depend on them
            foreach (Repository repo in Repository.Repositories)
            {
                issues = repo.Filter(issues);
            }

            return(issues.ToArray());
        }
예제 #2
0
 public static DataModelIssue FirstOrNull_ByIssueNumber(this IEnumerable <DataModelIssue> issues, DataModelIssue issue)
 {
     return(issues.Where(i => i.EqualsByNumber(issue)).FirstOrDefault());
 }
예제 #3
0
 public static bool Contains_ByIssueNumber(this IEnumerable <DataModelIssue> issues, DataModelIssue issue)
 {
     return(issues.Where(i => issue.EqualsByNumber(i)).Any());
 }
예제 #4
0
 public static DataModelIssue Last_ByIssueNumber(this IEnumerable <DataModelIssue> issues, DataModelIssue issue)
 {
     return(issues.Where(i => issue.EqualsByNumber(i)).Last());
 }