B4BCore.CheckBundles.CheckCdnBundle C# (CSharp) Метод

CheckCdnBundle() приватный Метод

private CheckCdnBundle ( string bundleName, ICollection allCdns ) : List
bundleName string
allCdns ICollection
Результат List
        private List<string> CheckCdnBundle(string bundleName, ICollection<CdnInfo> allCdns)
        {
            var errors = new List<string>();
            var productionFileName = allCdns.FirstOrDefault(x => x.Production != null)?.Production;
            if (productionFileName == null)
            {
                return new List<string> { $"In the CDN bundle called {bundleName} we need a property called {nameof(CdnInfo.Production)}"};
            }

            var fileExtension = Path.GetExtension(allCdns.First().Production);
            var fileTypeInfo = _config.GetFileTypeData(fileExtension);

            if (string.IsNullOrEmpty(fileTypeInfo.CdnHtmlFormatString))
            {
                return new List<string> { $"This configuration of BundlerForBower does not support CDN bundles for {fileExtension} files. Bad bundle is {bundleName}." };
            }

            var i = 0;
            foreach (var properties in allCdns.Select(cdnInfo => cdnInfo.FindMissingPropertiesNeededByHtmlInclude(fileTypeInfo.CdnHtmlFormatString).ToList()))
            {
                if (properties.Any())
                    errors.Add($"In the bundle called {bundleName}, array element {i}, the following properties were missing: {string.Join(", ", properties)}");
                i++;
            }
            if (errors.Any())
                return errors;

            AddErrorIfAnyFilesInBadFiles(bundleName,
                allCdns.Where(x => x.Development != null && RelPathSearcher.ContainsSearchChars(x.Development))
                .Select(x => x.Development).ToList(), "had 'development' with search strings", errors);
            AddErrorIfAnyFilesInBadFiles(bundleName,
                allCdns.Where(x => RelPathSearcher.ContainsSearchChars(x.Production))
                .Select(x => x.Development).ToList(), "had 'production' with search strings", errors);

            if (errors.Any())
                //If any errors so far then not worth continuing
                return errors;

            var allDevelopmentWithDate = allCdns
                .Select(x => new FileWithDateUpdated(_mvcAppPath, x.Development)).ToList();

            AddErrorIfAnyFilesInBadFiles(bundleName,
                allDevelopmentWithDate.Where(x => !x.Exists).Select(x => x.FileRelPath).ToList(), "in 'development' were missing", errors);

            var allProductionWithDate = allCdns
                .Select(x => new FileWithDateUpdated(_mvcAppPath, Path.Combine(fileTypeInfo.Directory, x.Production))).ToList();

            AddErrorIfAnyFilesInBadFiles(bundleName,
                allProductionWithDate.Where(x => !x.Exists).Select(x => x.FileRelPath).ToList(), "in 'production' were missing", errors);

            return errors;
        }