예제 #1
0
 public override IEnumerable <ProjectInfo> GetInfos(IEnumerable <string> uris)
 {
     foreach (string uri in uris)
     {
         if (IsExcelChecker.IsExcelFile(uri))
         {
             DataSet dataSet = this.GetExcelData(uri);
             foreach (ProjectInfo projectInfo in this.GetInfoFromRows(dataSet))
             {
                 this.ProjectInfoEnrichers.EnrichProject(uri, projectInfo, uri, dataSet);
                 yield return(projectInfo);
             }
         }
         else
         {
             throw new ArgumentException($"The type of file is not supported. Expected Excel file. {uri}");
         }
     }
 }
 public IEnumerable <string> GetUris(string rootUri, Regex ignoredPathsRegex = null)
 {
     this.logger.Info($"Getting URIs from {rootUri}");
     if (IsExcelChecker.IsExcelFile(rootUri))
     {
         yield return(rootUri);
     }
     else
     {
         DirectoryInfo          directory = new DirectoryInfo(rootUri);
         IEnumerable <FileInfo> query     = directory.EnumerateFiles("*.*", SearchOption.AllDirectories);
         if (ignoredPathsRegex != null)
         {
             query = query.Where(x => !ignoredPathsRegex.IsMatch(x.FullName));
         }
         foreach (var file in query.Where(x => IsExcelChecker.IsExcelFile(x.FullName)))
         {
             yield return(file.FullName);
         }
     }
 }