Microsoft.DocAsCode.Build.Engine.DocumentBuildContext.GetFilePath C# (CSharp) Method

GetFilePath() public method

public GetFilePath ( string key ) : string
key string
return string
        public string GetFilePath(string key)
        {
            if (string.IsNullOrEmpty(key)) throw new ArgumentNullException(nameof(key));
            string filePath;
            if (FileMap.TryGetValue(key, out filePath))
            {
                return filePath;
            }

            return null;
        }

Usage Example

示例#1
0
        public string ResolveSourceRelativePath(string originPath, string currentFileOutputPath)
        {
            if (string.IsNullOrEmpty(originPath) || !PathUtility.IsRelativePath(originPath))
            {
                return(originPath);
            }

            var origin = (RelativePath)originPath;

            if (origin == null)
            {
                return(originPath);
            }

            var destPath = _context.GetFilePath(origin.GetPathFromWorkingFolder().ToString());

            if (destPath != null)
            {
                return(((RelativePath)destPath - ((RelativePath)currentFileOutputPath).GetPathFromWorkingFolder()).ToString());
            }
            else
            {
                Logger.LogWarning($"Can't find output file for {originPath}");
                return(originPath);
            }
        }
All Usage Examples Of Microsoft.DocAsCode.Build.Engine.DocumentBuildContext::GetFilePath