Пример #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 DecodeClick(object sender, EventArgs e)
        {
            filePathDecodedImage = $"{filePathDecodedImage}.bmp";
            if (File.Exists(filePathDecodedImage))
            {
                File.Delete(filePathDecodedImage);
            }

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

            using (var fileStream = new FileStream(filePathDecodedImage, FileMode.Open))
            {
                var bmp = new Bitmap(fileStream);
                pictureBoxDecodedImage.Image = bmp;
            }
        }