Example #1
0
        private void pbStep2_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            Config         cfg             = new Config();
            String         path            = cfg.Get(Config.ANSWER_SHEET_IMG_PATH, "");

            if (path != "")
            {
                openFileDialog1.InitialDirectory = path;
            }
            openFileDialog1.Title            = "Chọn danh sách ảnh bài thi";
            openFileDialog1.CheckFileExists  = true;
            openFileDialog1.CheckPathExists  = true;
            openFileDialog1.Filter           = "dat Files (*.dat)|*.dat";
            openFileDialog1.DefaultExt       = "dat";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.ReadOnlyChecked  = true;
            openFileDialog1.ShowReadOnly     = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string filePath   = openFileDialog1.FileName;
                byte[] imageBytes = File.ReadAllBytes(filePath);
                if (SigningHelper.VerifyImages(imageBytes))
                {
                    List <Bitmap> imgs = SigningHelper.GetImagesFromEncryptedBytes(imageBytes);
                    bgImageProcessing.RunWorkerAsync(imgs);
                    processProgressBar.Visible           = true;
                    lbProcessProgressDescription.Visible = true;
                }
                else
                {
                    MessageBox.Show("File ảnh bài thi bị lỗi!!");
                }
            }
        }