예제 #1
0
        public void ImageIsEncodedThenDecodedCorrectlyWithImagePredictor0()
        {
            var imagePredictor = new ImagePredictor0();

            using (var fileReader = new FileReader(filePathSource, new Buffer()))
            {
                using (var fileWriter = new FileWriter(filePathEncodedFile, new Buffer()))
                {
                    imagePredictionEncoder.EncodeImage(fileReader, fileWriter, imagePredictor);
                }
            }

            using (var fileReader = new FileReader(filePathEncodedFile, new Buffer()))
            {
                using (var fileWriter = new FileWriter(filePathDecodedFile, new Buffer()))
                {
                    imagePredictionDecoder.DecodeImage(fileReader, fileWriter);
                }
            }

            Assert.IsTrue(TestMethods.FilesHaveTheSameContent(filePathSource, filePathDecodedFile));
        }
예제 #2
0
        private void PredictClick(object sender, EventArgs e)
        {
            var imagePredictorToUse  = DetermineImagePredictor();
            var filePathEncodedImage = $"{filePathOriginalImage}.pre";

            if (File.Exists(filePathEncodedImage))
            {
                File.Delete(filePathEncodedImage);
            }

            using (var fileReader = new FileReader(filePathOriginalImage, new Buffer()))
            {
                using (var fileWriter = new FileWriter($"{filePathOriginalImage}.pre", new Buffer()))
                {
                    imagePredictionEncoder.EncodeImage(fileReader, fileWriter, imagePredictorToUse);
                }
            }
        }