public IEnumerable <string> FindTrxFiles(string buildRootDirectory, bool shouldLog = true) { Debug.Assert(!string.IsNullOrEmpty(buildRootDirectory)); Debug.Assert(directoryWrapper.Exists(buildRootDirectory), "The specified build root directory should exist: " + buildRootDirectory); if (shouldLog) { this.logger.LogInfo(Resources.TRX_DIAG_LocatingTrx); } var testDirectories = directoryWrapper.GetDirectories(buildRootDirectory, TestResultsFolderName, SearchOption.AllDirectories); if (testDirectories == null || !testDirectories.Any()) { if (shouldLog) { this.logger.LogInfo(Resources.TRX_DIAG_TestResultsDirectoryNotFound, buildRootDirectory); } return(Enumerable.Empty <string>()); } if (shouldLog) { this.logger.LogInfo(Resources.TRX_DIAG_FolderPaths, string.Join(", ", testDirectories)); } var trxFiles = testDirectories.SelectMany(dir => directoryWrapper.GetFiles(dir, "*.trx")).ToArray(); if (shouldLog) { if (trxFiles.Length == 0) { this.logger.LogInfo(Resources.TRX_DIAG_NoTestResultsFound); } else { this.logger.LogInfo(Resources.TRX_DIAG_TrxFilesFound, string.Join(", ", trxFiles)); } } return(trxFiles); }
public List <string> GetPossibleConfigVarsFilepaths() { if (!string.IsNullOrEmpty(_configurationService.CustomProfileVarsFileSearchLocation)) { var customProfilePath = _environmentWrapper.ExpandEnvironmentVariables(_configurationService.CustomProfileVarsFileSearchLocation); if (_fileWrapper.Exists(customProfilePath)) { var attributes = _fileWrapper.GetAttributes(customProfilePath); if (!attributes.HasFlag(FileAttributes.Directory)) { return(new List <string> { customProfilePath }); } var files = _directoryWrapper.GetFiles(customProfilePath); return(files.Where(x => x.EndsWith(".vars.Arma3Profile")).ToList()); } } var possibleConfigVarsPaths = new List <string>(); var defaultProfilePath = _environmentWrapper.ExpandEnvironmentVariables(_configurationService.DefaultProfileVarsFileSearchLocation); var defaultPathFiles = _directoryWrapper.GetFiles(defaultProfilePath).Where(x => x.EndsWith(".vars.Arma3Profile")).ToList(); possibleConfigVarsPaths.AddRange(defaultPathFiles); var otherProfilePath = _environmentWrapper.ExpandEnvironmentVariables(_configurationService.OtherProfilesVarsFileSearchLocation); var otherProfileDirectories = _directoryWrapper.GetDirectories(otherProfilePath).ToList(); otherProfileDirectories.ForEach( directory => possibleConfigVarsPaths.AddRange( _directoryWrapper.GetFiles(directory) .Where(x => x.EndsWith(".vars.Arma3Profile")).ToList())); return(possibleConfigVarsPaths); }