private void credentialBtn_Click(object sender, EventArgs e) { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = System.Environment.CurrentDirectory; openFileDialog.Filter = "json files (*.json)|*.json"; openFileDialog.FilterIndex = 2; if (openFileDialog.ShowDialog() == DialogResult.OK) { var authPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\Authentication"; var toCopy = authPath + "\\" + Path.GetFileName(openFileDialog.FileName); if (openFileDialog.FileName.Equals(toCopy)) { showMessageBox("파일이름이 동일합니다."); return; } if (!System.IO.Directory.Exists(authPath)) { System.IO.Directory.CreateDirectory(authPath); } if (File.Exists(toCopy)) { File.Delete(toCopy); } File.Copy(openFileDialog.FileName, toCopy); credentialTextBox.Text = authPath + "\\" + Path.GetFileName(openFileDialog.FileName); AppConfiguration.SetAppConfig("CredentialPath", authPath + "\\" + Path.GetFileName(openFileDialog.FileName)); } } }
private void readyToStartBackup(object sender, EventArgs e) { if (sender == googleDriveTextBox) { AppConfiguration.SetAppConfig("NameOnGoogleDrive", googleDriveTextBox.Text); } if (String.IsNullOrEmpty(googleDriveTextBox.Text) || String.IsNullOrEmpty(localFolderTextBox.Text) || String.IsNullOrEmpty(credentialTextBox.Text) || !FileInfoExtension.isDirectory(localFolderTextBox.Text)) { startCancelBtn.Enabled = false; } else { startCancelBtn.Enabled = true; } }
private void button2_Click(object sender, EventArgs e) { var folderDlg = new FolderBrowserDialog(); folderDlg.ShowNewFolderButton = true; DialogResult result = folderDlg.ShowDialog(); if (result != DialogResult.OK) { return; } var path = new DirectoryInfo(folderDlg.SelectedPath); if (!path.Exists) { path.Create(); } localFolderTextBox.Text = folderDlg.SelectedPath; AppConfiguration.SetAppConfig("LocalPath", folderDlg.SelectedPath); }
private void sourceDeleteChanged(object sender, EventArgs e) { var t = Convert.ToString(sourceFolderDeleteAfterCopy.Checked); AppConfiguration.SetAppConfig("SourceDelete", t); }