Exemplo n.º 1
0
        public Task<RuntimeFile> GetRuntimes(WalkProviderMatch match, FrameworkName targetFramework)
        {
            foreach(var path in _dependencyProvider.GetAttemptedPaths(targetFramework))
            {
                var runtimeJsonPath = path
                    .Replace("{name}.nuspec", "runtime.json")
                    .Replace("project.json", "runtime.json")
                    .Replace("{name}", match.Library.Name)
                    .Replace("{version}", match.Library.Version.ToString());

                // Console.WriteLine("*** {0}", runtimeJsonPath);
                if (File.Exists(runtimeJsonPath))
                {
                    Console.WriteLine("*** READING {0}", runtimeJsonPath);
                    var formatter = new RuntimeFileFormatter();
                    return Task.FromResult(formatter.ReadRuntimeFile(runtimeJsonPath));
                }
            }
            return Task.FromResult<RuntimeFile>(null);
        }
Exemplo n.º 2
0
 public async Task<RuntimeFile> GetRuntimes(WalkProviderMatch match, FrameworkName targetFramework)
 {
     using (var stream = await _source.OpenRuntimeStreamAsync(new PackageInfo
     {
         Id = match.Library.Name,
         Version = match.Library.Version,
         ContentUri = match.Path
     }))
     {
         if (stream != null)
         {
             var formatter = new RuntimeFileFormatter();
             using (var reader = new StreamReader(stream))
             {
                 return formatter.ReadRuntimeFile(reader);
             }
         }
     }
     return null;
 }