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

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

private CheckNonCdnBundle ( string bundleName, IEnumerable allBundleDebugLines ) : List
bundleName string
allBundleDebugLines IEnumerable
Результат List
        private List<string> CheckNonCdnBundle(string bundleName, IEnumerable<string> allBundleDebugLines)
        {
            var errors = new List<string>();
            var allFilesWithDate = _searcher.UnpackBundle(allBundleDebugLines, s => errors.Add(s))
                .Select(x => new FileWithDateUpdated(_mvcAppPath, x)).ToList();

            if (!allFilesWithDate.Any())
            {
                errors.Add($"The bundle called {bundleName} did not contain any files to work on.");
                return errors;
            }

            var fileExtension = Path.GetExtension(allFilesWithDate.First().FileRelPath);
            var fileTypeInfo = _config.GetFileTypeData(fileExtension);

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

            FileWithDateUpdated concatFileInfo = null;
            if (_checkForConcatFile)
            {
                concatFileInfo = new FileWithDateUpdated(_mvcAppPath,
                    Path.Combine(_mvcAppPath, fileTypeInfo.Directory, bundleName + fileExtension));
                if (!concatFileInfo.Exists)
                {
                    errors.Add($"Warning: the concat file for '{bundleName}' is missing. Continuing test.");
                    concatFileInfo = null;
                }
            }
            var minfiedFileInfo =
                new FileWithDateUpdated(_mvcAppPath,
                    Path.Combine(_mvcAppPath, fileTypeInfo.Directory, bundleName + ".min" + fileExtension));
            if (!minfiedFileInfo.Exists)
            {
                errors.Add($"The minified file for '{bundleName}' is missing.");
                return errors;
            }

            var newerFiles =
                allFilesWithDate.Where(x => x.LastWrittenUtc > (concatFileInfo ?? minfiedFileInfo).LastWrittenUtc)
                    .Select(x => x.FileRelPath).ToList();
            if (newerFiles.Any())
            {
                var concatOrMinfied = concatFileInfo == null ? "minified" : "concat";
                errors.Add(
                    $"The {concatOrMinfied} file for '{bundleName}' is out of date. Newer files are:\n - {string.Join("\n - ", newerFiles)}");

            }

            if (_checkForConcatFile && concatFileInfo != null && minfiedFileInfo.LastWrittenUtc < concatFileInfo.LastWrittenUtc)
                errors.Add($"The concat file for '{bundleName}' is newer than the minified file.");

            return errors;
        }