RelativePath() публичный статический Метод

Returns the relative path from a base directory to another directory or file.
public static RelativePath ( string from, string to ) : string
from string
to string
Результат string
Пример #1
0
        private void ConfigList_SelectionChanged()
        {
            IProjectConfig selectedConfig = _view.ConfigList.SelectedIndex >= 0
                ? _model.Configs[_view.ConfigList.SelectedIndex]
                : null;

            if (selectedConfig != null)
            {
                RuntimeFramework framework = selectedConfig.RuntimeFramework;
                _view.Runtime.SelectedItem = framework.Runtime.ToString();
                _view.RuntimeVersion.Text  = framework.Version == new Version()
                    ? string.Empty
                    : framework.Version.ToString();

                if (selectedConfig.BasePath == null)
                {
                    _view.ApplicationBase.Text = _model.EffectiveBasePath;
                }
                else
                {
                    _view.ApplicationBase.Text = PathUtils.RelativePath(
                        Path.Combine(_model.EffectiveBasePath, selectedConfig.BasePath),
                        selectedConfig.BasePath);
                }
                _view.ConfigurationFile.Text    = selectedConfig.ConfigurationFile;
                _view.BinPathType.SelectedIndex = (int)selectedConfig.BinPathType;
                if (selectedConfig.BinPathType == BinPathType.Manual)
                {
                    _view.PrivateBinPath.Text = selectedConfig.PrivateBinPath;
                }
                else
                {
                    _view.PrivateBinPath.Text = string.Empty;
                }

                SetAssemblyList();
            }
            else
            {
                _view.Runtime.SelectedItem = "Any";
                _view.RuntimeVersion.Text  = string.Empty;

                _view.ApplicationBase.Text      = null;
                _view.ConfigurationFile.Text    = string.Empty;
                _view.PrivateBinPath.Text       = string.Empty;
                _view.BinPathType.SelectedIndex = (int)BinPathType.Auto;

                _view.AssemblyList.SelectionList = new string[0];
                _view.AssemblyPath.Text          = string.Empty;
            }
        }
Пример #2
0
        private void AddAssembly()
        {
            string assemblyPath = view.DialogManager.GetFileOpenPath(
                "Select Assembly",
                "Assemblies (*.dll,*.exe)|*.dll;*.exe|All Files (*.*)|*.*",
                view.AssemblyPath.Text);

            if (assemblyPath != null)
            {
                assemblyPath = PathUtils.RelativePath(selectedConfig.EffectiveBasePath, assemblyPath);
                selectedConfig.Assemblies.Add(assemblyPath);
                SetAssemblyList();
            }
        }
Пример #3
0
        private void AddAssemblyCommand_Execute()
        {
            string assemblyPath = _view.DialogManager.GetFileOpenPath(
                "Select Assembly",
                "Assemblies (*.dll,*.exe)|*.dll;*.exe|All Files (*.*)|*.*",
                _view.AssemblyPath.Text);

            if (assemblyPath != null)
            {
                var basePath = _model.EffectiveBasePath;
                if (_selectedConfig.BasePath != null)
                {
                    basePath = Path.Combine(_model.EffectiveBasePath, _selectedConfig.BasePath);
                }
                assemblyPath = PathUtils.RelativePath(basePath, assemblyPath);
                _selectedConfig.Assemblies.Add(assemblyPath);
                SetAssemblyList();
            }
        }