private void buttonLoadOverviewImage_Click(object sender, EventArgs e) { //Prefer using current entry's path // string OldFileName = GetRegKey( "LastOverviewImageFileName", Path.Combine( m_ApplicationPath, "Stuff.jpg" ) ); string OldFileName = m_SelectedEntry.FullPath.FullName; openFileDialogOverviewImage.InitialDirectory = Path.GetDirectoryName(OldFileName); openFileDialogOverviewImage.FileName = Path.GetFileName(OldFileName); if (openFileDialogOverviewImage.ShowDialog(this) != DialogResult.OK) { return; } SetRegKey("LastOverviewImageFileName", openFileDialogOverviewImage.FileName); try { string RelativePath = Database.GetRelativePath(m_Database.RootPath.FullName, openFileDialogOverviewImage.FileName); if (RelativePath.StartsWith("..")) { throw new Exception("The overview image path is not contained under the database root path! Choose an image that is inside the database folder hierarchy."); } m_SelectedEntry.OverviewImageFileName = new FileInfo(openFileDialogOverviewImage.FileName); UpdateUIFromEntry(m_SelectedEntry); } catch (Exception _e) { MessageBox("An error occurred while opening the overview image:\n\n", _e); } }
private string F(string _FullPath) { string RelativeFileName = m_Owner.GetRelativePath(_FullPath); RelativeFileName = RelativeFileName.Replace('\\', '/'); return(RelativeFileName); }