private void OpenBtn_Click(object sender, EventArgs e) { if (OpenDlg.ShowDialog() == DialogResult.OK) { Img.Image = new Bitmap(OpenDlg.FileName); } }
private void OpenFile() { if (OpenDlg.ShowDialog() == DialogResult.OK) { CloseFile(); try { HideIt.Audio.PlayerWaveStream S = new HideIt.Audio.PlayerWaveStream(OpenDlg.FileName); if (S.Length <= 0) { throw new Exception("Invalid WAV file"); } m_Format = S.Format; if (m_Format.wFormatTag != (short)HideIt.Audio.WaveFormats.Pcm && m_Format.wFormatTag != (short)HideIt.Audio.WaveFormats.Float) { throw new Exception("Olny PCM files are supported"); } m_AudioStream = S; ///Get file name from path this.lbl_audioPoemName.Text = Path.GetFileName(this.OpenDlg.FileName); } catch (Exception e) { CloseFile(); MessageBox.Show(e.Message); } } }
private void btnBrowse_Click(object sender, EventArgs e) { DialogResult result = OpenDlg.ShowDialog(); if (result == DialogResult.OK) { edExe.Text = OpenDlg.FileName; } }
private void BrowseBtn_Click(object sender, EventArgs e) { DialogResult Res = OpenDlg.ShowDialog(); if (!Res.HasFlag(DialogResult.Cancel)) { PathBox.Text = OpenDlg.FileName; } }
private void OpenBtn_Click(object sender, EventArgs e) { DialogResult Res = OpenDlg.ShowDialog(); if (!Res.HasFlag(DialogResult.Cancel) && System.IO.File.Exists(OpenDlg.FileName)) { Img = new Bitmap(OpenDlg.FileName); PicBox.Image = Img; } }
private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenDlg.Filter = "Image Files (*.JPG)|*.Jpg|Bitmap Files (*.Bmp)|*.Bmp| Gif Files (*.Gif)|*.gif"; OpenDlg.ShowDialog(); OpenDlg.FilterIndex = 1; PicPath = OpenDlg.FileName.ToString(); if (PicPath == "OpenFileDialog1" | string.IsNullOrEmpty(PicPath)) { return; } PicDoc.Load(PicPath); // AutosizeImage(PicPath, PicDoc); //PicDoc.Image = FixedSize(PicDoc.Image, 100, 100); int sourceWidth = PicDoc.Image.Width; int sourceHeight = PicDoc.Image.Height; //if (sourceWidth > 300 || sourceHeight > 360) //{ // MessageBox.Show("Picture Size is Abnormal, Size not Exceed 300x360"); // PicDoc.Image = null; // FileByteArray = null; // return; //} PicDoc.SizeMode = PictureBoxSizeMode.CenterImage; // FileByteArray = convertPicBoxImageToByte(PicDoc); o = new FileStream(PicPath, FileMode.Open, FileAccess.Read, FileShare.Read); r = new StreamReader(o); Array.Resize <byte>(ref FileByteArray, Convert.ToInt32(o.Length)); o.Read(FileByteArray, 0, Convert.ToInt32(o.Length)); barButtonItem4.Enabled = true; barButtonItem6.Enabled = false; }
private void button3_Click(object sender, EventArgs e) { OpenDlg.InitialDirectory = "./"; if (btnDer.Checked) { OpenDlg.Filter = "der Files|*.der|All Files|*.*"; } if (btnData.Checked) { OpenDlg.Filter = "BIN Files(*.bin)|*.bin"; } OpenDlg.FilterIndex = 1; OpenDlg.RestoreDirectory = true; try { if (OpenDlg.ShowDialog() == DialogResult.OK) { try { var fPath = string.Empty; fPath = OpenDlg.FileName; var fStream = OpenDlg.OpenFile(); int bytelength = (int)fStream.Length; var byteKey = string.Empty; var publicKey = string.Empty; byteValue = File.ReadAllBytes(fPath); if (btnDer.Checked) { X509Certificate der = new X509Certificate(byteValue); X509Certificate2 cert = new X509Certificate2(byteValue); //publicKey = Convert.ToBase64String(cert.GetPublicKey()); byteKey = Convert.ToBase64String(cert.RawData); int splitLen = 512; keyLen = byteKey.Length / splitLen; textBox_msg.Text += keyLen; textBox_msg.AppendText("\r\n#########################################KEY LEN\r\n"); //textBox_msg.Text += Convert.ToBase64String(byteValue); //rawdata와 같은 값. //textBox_msg.AppendText(Convert.ToString(bytelength)); //읽어온 der 총길이 //textBox_msg.AppendText("\r\n###############################################\r\n"); textBox_msg.Text += krKey; textBox_msg.AppendText("\r\n#########################################Kr KEY\r\n"); textBox_msg.Text += publicKey; textBox_msg.AppendText("\r\n#########################################PUBLIC KEY\r\n"); textBox_msg.Text += byteKey; textBox_msg.AppendText("\r\n#########################################BYTE KEY\r\n"); if (keyLen > 1) { DerValue0 = byteKey.Substring(0, 512); DerValue1 = byteKey.Substring(512, 512); DerValue2 = byteKey.Substring(1024, 512); DerValue3 = byteKey.Substring(1536, 512); DerValue4 = byteKey.Substring(2048); } else { DerValue0 = byteKey; } textBox_msg.AppendText("\r\nTRIM THE KEY\r\n##########111##########\r\n"); textBox_msg.AppendText(DerValue0 + "\r\n##########222##########\r\n"); textBox_msg.AppendText(DerValue1 + "\r\n##########333##########\r\n"); textBox_msg.AppendText(DerValue2 + "\r\n##########444##########\r\n"); textBox_msg.AppendText(DerValue3 + "\r\n##########555##########\r\n"); textBox_msg.AppendText(DerValue4); textBox_msg.ScrollToCaret(); } else if (btnData.Checked) { int splitLen = 1024; bytelen = byteValue.Length / splitLen; byteKey = Convert.ToBase64String(byteValue); textBox_msg.AppendText("\r\n#########################################" + bytelen + "\r\n" + "\r\n"); progressBar1.Maximum = bytelen; for (int i = 0; i < bytelen; i++) { textBox_msg.AppendText("\r\n" + i + "/" + bytelen + "\r\n"); DV[i] = byteKey.Substring(i * splitLen, splitLen); progressBar1.Value++; } progressBar1.Value = progressBar1.Maximum; DV[bytelen] = byteKey.Substring(bytelen * splitLen); } } catch { } finally { if (btnDer.Checked) { MessageBox.Show("include .der file"); } if (btnData.Checked) { MessageBox.Show("include file"); } } } } catch { } finally { } }