Esempio n. 1
0
        private void btnSelectFile_Click(object sender, EventArgs e)
        {
            try {
                ReadDataPath();
                OpenFileDialog fileDialog = new OpenFileDialog();
                fileDialog.RestoreDirectory = true;
                fileDialog.Title            = "Select File";
                fileDialog.Filter           = "data files (*.enc)|*.enc";
                fileDialog.FilterIndex      = 1;
                fileDialog.DefaultExt       = "enc";
                fileDialog.CheckFileExists  = false;
                fileDialog.ValidateNames    = false;
                fileDialog.CheckPathExists  = true;
                fileDialog.Multiselect      = false;


                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    info = new FileInfo(fileDialog.FileName);
                    dataCryptor.inPutFilePath(fileDialog.FileName);
                    dataCryptor.FileType(info.Extension);
                    txtFileName.Text = info.Name;
                    dataCryptor.FileType(info.Name.Substring(0, info.Name.Length - info.Extension.Length), info.Extension);
                    dataCryptor.outPutFilePath(decrepted_file_path);
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Import Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void btnOutfutFolder_Click(object sender, EventArgs e)
        {
            OpenFileDialog folderBrowser = new OpenFileDialog();

            // Set validate names and check file exists to false otherwise windows will
            // not let you select "Folder Selection."
            folderBrowser.RestoreDirectory = true;
            folderBrowser.ValidateNames    = false;
            folderBrowser.CheckFileExists  = false;
            folderBrowser.CheckPathExists  = true;
            // Always default to Folder Selection.
            folderBrowser.FileName = "Folder Selection.";
            if (folderBrowser.ShowDialog() == DialogResult.OK)
            {
                dataCryptor.outPutFilePath(Path.GetDirectoryName(folderBrowser.FileName));
                string folderPath = Path.GetDirectoryName(folderBrowser.FileName);
                txtFolderName.Text = folderPath;
                // ...
            }
        }