コード例 #1
0
        private void convertSingleButton_Click(object sender, EventArgs e)
        {
            var filePath = ioHandler.SelectFile();

            var    matrixSize = GetMatrixSize();
            string error;
            var    encodedImage = ColorCutter.EncodeImage(filePath, matrixSize[0], matrixSize[1], out error);

            if (!string.IsNullOrEmpty(error) || encodedImage == null)
            {
                ShowErrorNotification(error);
                return;
            }
            var sb = new StringBuilder();
            var arrayPrefixName  = GetArrayPrefixName();
            var arrayElementName = string.Format("{0}00", arrayPrefixName);

            ioHandler.EncodeAndAddAsText(encodedImage, arrayElementName, sb);
            var arrayElementNames = new List <string>()
            {
                arrayElementName
            };

            ioHandler.AddArrayDeclaration(sb, arrayPrefixName, arrayElementNames);
            ioHandler.SaveToFile(sb);
            pictureBox1.Image = TestImagesStorage.DecodeImage(encodedImage);
        }
コード例 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     pictureBox1.Image = TestImagesStorage.GetMarioImage();
 }