private void OnSelectBackgroundImage(object sender, EventArgs args) { string t = GCUtil.SelectPictureFileByDialog(FindForm()); if (t != null) { _backgroundImageBox.Text = t; _defaultFileDir = GUtil.FileToDir(t); } }
private void OnSaveOpenSSHPublicKey(object sender, EventArgs args) { SaveFileDialog dlg = new SaveFileDialog(); dlg.InitialDirectory = GApp.Options.DefaultKeyDir; dlg.Title = GApp.Strings.GetString("Caption.KeyGenWizard.SavePublicInOpenSSH"); dlg.DefaultExt = "pub"; dlg.Filter = "SSH Public Key(*.pub)|*.pub|All Files(*.*)|*.*"; if (GCUtil.ShowModalDialog(this, dlg) == DialogResult.OK) { GApp.Options.DefaultKeyDir = GUtil.FileToDir(dlg.FileName); try { _resultKey.WritePublicPartInOpenSSHStyle(new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write)); } catch (Exception ex) { GUtil.Warning(this, String.Format(GApp.Strings.GetString("Message.KeyGenWizard.KeySaveError"), ex.Message)); } } }
private void OnSelectFile(object sender, EventArgs args) { OpenFileDialog dlg = new OpenFileDialog(); dlg.CheckFileExists = true; dlg.Multiselect = false; dlg.InitialDirectory = GApp.Options.DefaultFileDir; dlg.Title = GApp.Strings.GetString("Caption.ModuleProperty.SelectMacroFile"); dlg.Filter = "JScript.NET Files(*.js)|*.js|.NET Executables(*.exe;*.dll)|*.exe;*.dll"; if (GCUtil.ShowModalDialog(this, dlg) == DialogResult.OK) { GApp.Options.DefaultFileDir = GUtil.FileToDir(dlg.FileName); _path.Text = dlg.FileName; if (_title.Text.Length == 0) { _title.Text = System.IO.Path.GetFileName(dlg.FileName); //ファイル名本体をデフォルトのタイトルにする } } }
private void OnSavePrivateKey(object sender, EventArgs args) { SaveFileDialog dlg = new SaveFileDialog(); dlg.InitialDirectory = GApp.Options.DefaultKeyDir; dlg.Title = GApp.Strings.GetString("Caption.KeyGenWizard.SavePrivateKey"); if (GCUtil.ShowModalDialog(this, dlg) == DialogResult.OK) { GApp.Options.DefaultKeyDir = GUtil.FileToDir(dlg.FileName); try { string pp = _passphraseBox.Text; if (pp.Length == 0) { pp = null; //空パスフレーズはnull指定 } _resultKey.WritePrivatePartInSECSHStyleFile(new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write), "", pp); } catch (Exception ex) { GUtil.Warning(this, String.Format(GApp.Strings.GetString("Message.KeyGenWizard.KeySaveError"), ex.Message)); } } }