private static string GetDocumentPath([NotNull] IThreatModel model, [Required] string relativePath)
        {
            string result = null;

            if (Path.IsPathRooted(relativePath))
            {
                result = relativePath;
            }
            else
            {
                var modelPath = model.GetLocation();
                result = modelPath != null?
                         GetAbsolutePath(Path.GetDirectoryName(modelPath), relativePath) : relativePath;
            }

            return(result);
        }
示例#2
0
        private void _browse_Click(object sender, EventArgs e)
        {
            if (_openFile.ShowDialog(this) == DialogResult.OK)
            {
                string path;
                var    modelPath = _model?.GetLocation();
                if (modelPath == null)
                {
                    path = _openFile.FileName;
                }
                else
                {
                    path = GetRelativePath(modelPath, _openFile.FileName);
                }

                WordFile = _wordFile.Text = path;
                LoadDocStructure(_openFile.FileName);
            }
        }