ExcelDna.Integration.DnaLibrary.ResolvePath C# (CSharp) Method

ResolvePath() public method

public ResolvePath ( string path ) : string
path string
return string
        public string ResolvePath(string path)
        {
            return ResolvePath(path, dnaResolveRoot);
        }

Same methods

DnaLibrary::ResolvePath ( string path, string dnaDirectory ) : string

Usage Example

Example #1
0
 // Returns the resulting source for this SourceItem.
 // If Path is filled in, and file exists, takes source from there.
 // Else returns Code value.
 public string GetSource(string pathResolveRoot)
 {
     if (!string.IsNullOrEmpty(Path))
     {
         if (Path.StartsWith("packed:"))
         {
             string resourceName = Path.Substring(7);
             byte[] sourceBytes  = ExcelIntegration.GetSourceBytes(resourceName);
             return(Encoding.UTF8.GetString(sourceBytes));
         }
         else
         {
             // Try to read from a file.
             string resolvedPath = DnaLibrary.ResolvePath(Path, pathResolveRoot);
             if (resolvedPath == null)
             {
                 Debug.Print("Source path {0} could not be resolved.", Path);
             }
             else
             {
                 return(File.ReadAllText(resolvedPath).Trim());
             }
         }
     }
     return(Code);
 }
All Usage Examples Of ExcelDna.Integration.DnaLibrary::ResolvePath