コード例 #1
0
        //TODO
        public override IEnumerable <Test> MakeTestBlocks()
        {
            using (var archive = new SevenZipArchive(_workPath, ArchiveFormat.Unkown, _password))
            {
                var inputFiles = archive.Where(x => InputFilePattern.GetFullRegex().IsMatch(x.FileName));
                var ouputFiles = archive.Where(x => OutputFilePattern.GetFullRegex().IsMatch(x.FileName));
                var comparer   = new TestFileNameComparer(InputFilePattern, OutputFilePattern);

                foreach (var inputFile in inputFiles)
                {
                    foreach (var outputFile in ouputFiles)
                    {
                        var inName  = inputFile.FileName;
                        var outName = outputFile.FileName;

                        if (comparer.Equals(inName, outName))
                        {
                            var idTest = InputFilePattern.GetNumberPart(inName);

                            yield return(new Test(
                                             inputFile.ExtractToStreamReader(),
                                             outputFile.ExtractToStreamReader(),
                                             idTest,
                                             _configTestsetProvider.TimeLimitFor(idTest),
                                             _configTestsetProvider.MemoryLimitFor(idTest),
                                             _configTestsetProvider.PriceFor(idTest)
                                             ));
                        }
                    }
                }
            }
        }
コード例 #2
0
        public override IEnumerable <Test> MakeTestBlocks()
        {
            _logger.Info("Find test files...");

            String[] inputFiles  = GetFilesByMask(InputFilePattern.GetFullRegex());
            String[] outputFiles = GetFilesByMask(OutputFilePattern.GetFullRegex());

            var tests = MakeTestBlocks(inputFiles, outputFiles);

            _logger.Info("Test blocks ready");

            return(tests);
        }
コード例 #3
0
        public void Create()
        {
            var inputFiles = Directory.GetFiles(_workPath)
                             .Where(file => InputFilePattern.GetFullRegex().IsMatch(file));

            foreach (var inputFile in inputFiles)
            {
                var result = _creator.Create(new StreamReader(inputFile));
                result.BaseStream.Position = 0;
                var nameOutputFile = CreateOutputFileName(inputFile);

                var writer = new StreamWriter(nameOutputFile);
                writer.Write(result.ReadToEnd());
                writer.Close();
            }
        }