public override string ResolveReference(string path, string baseFilePath) { var uri = GetUri(path); if (uri == null) { return(_fileBasedResolver.ResolveReference(path, baseFilePath)); } var client = new HttpClient(); var response = client.GetAsync(path).Result; if (response.IsSuccessStatusCode) { _remoteFiles[path] = response.Content.ReadAsByteArrayAsync().Result; } return(path); }
public override string ResolveReference(string path, string baseFilePath) { var uri = GetUri(path); if (uri == null) { return(_fileBasedResolver.ResolveReference(path, baseFilePath)); } var client = new HttpClient(); var response = client.GetAsync(path).Result; if (response.IsSuccessStatusCode) { var responseFile = response.Content.ReadAsStringAsync().Result; if (!string.IsNullOrWhiteSpace(responseFile) && !_remoteFiles.ContainsKey(path)) { _remoteFiles.Add(path, responseFile); } } return(path); }
/// <summary> /// Resolves specified path with respect to base file path. /// /// This is the second method called for each reference /// </summary> /// <param name="path">The path to resolve. May be absolute or relative.</param> /// <param name="baseFilePath">Path of the source file that contains the <paramref name="path" /> (may also be relative), or null if not available.</param> /// <returns> /// Normalized path, or null if the file can't be resolved. /// </returns> public override string ResolveReference(string path, string baseFilePath) { return(_sourceFileResolver.ResolveReference(path, baseFilePath)); }