AlbedoDatabaseGenerator.Database.GetRelativePath C# (CSharp) Метод

GetRelativePath() публичный Метод

public GetRelativePath ( string filespec ) : string
filespec string
Результат string
        public string GetRelativePath( string filespec )
        {
            return GetRelativePath( m_RootPath.FullName, filespec );
        }

Same methods

Database::GetRelativePath ( string folder, string filespec ) : string

Usage Example

Пример #1
0
        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);
            }
        }
All Usage Examples Of AlbedoDatabaseGenerator.Database::GetRelativePath