private byte[] GetZipBytesForChecker(string code) { var excluded = (PathsToExcludeForChecker ?? new string[0]) .Concat(initialPatterns) .Concat(wrongAnswerPatterns) .ToList(); var toUpdateDirectories = PathsToIncludeForChecker .Select(pathToInclude => new DirectoryInfo(Path.Combine(UnitDirectory.FullName, pathToInclude))); var toUpdate = GetCodeFile(code).ToList(); var zipBytes = ToZip(ExerciseDirectory, excluded, toUpdate, toUpdateDirectories); log.Info($"Собираю zip-архив для проверки: zip-архив собран, {zipBytes.Length} байтов"); return(zipBytes); }
public MemoryStream GetZipForChecker() { log.Info($"Собираю zip-архив для проверки: курс {CourseId}, слайд «{Slide?.Title}» ({Slide?.Id})"); var excluded = (PathsToExcludeForChecker ?? new string[0]) .Concat(initialPatterns) .Concat(wrongAnswerPatterns) .Concat(solutionPatterns) .Concat(new[] { "/bin/", "/obj/", ".idea/", ".vs/" }) .ToList(); var toUpdateDirectories = PathsToIncludeForChecker .EmptyIfNull() .Select(pathToInclude => new DirectoryInfo(Path.Combine(UnitDirectory.FullName, pathToInclude))) .Select(d => d.FullName); var directoriesToInclude = toUpdateDirectories.Append(ExerciseDirectory.FullName).ToList(); var ms = ZipUtils.CreateZipFromDirectory(directoriesToInclude, excluded, null, Encoding.UTF8); log.Info($"Собираю zip-архив для проверки: zip-архив собран, {ms.Length} байтов"); return(ms); }