public void SaveSelected() { // Copied from PwEntryForm.OnBtnBinSave (PwEntryForm.cs) var lvsc = SelectedObjects.Cast <RowObject>().ToList(); int nSelCount = lvsc.Count; if (nSelCount == 0) { Debug.Assert(false); return; } if (nSelCount == 1) { SaveFileDialogEx sfd = UIUtil.CreateSaveFileDialog(KPRes.AttachmentSave, lvsc[0].Name, UIUtil.CreateFileTypeFilter(null, null, true), 1, null, KeePass.App.AppDefs.FileDialogContext.Attachments); if (sfd.ShowDialog() == DialogResult.OK) { SaveAttachmentTo(lvsc[0].Binary, sfd.FileName, false); } } else // nSelCount > 1 { FolderBrowserDialog fbd = UIUtil.CreateFolderBrowserDialog(KPRes.AttachmentsSave); if (fbd.ShowDialog() == DialogResult.OK) { string strRootPath = UrlUtil.EnsureTerminatingSeparator(fbd.SelectedPath, false); foreach (var lvi in lvsc) { SaveAttachmentTo(lvi.Binary, strRootPath + lvi.Name, true); } } fbd.Dispose(); } }