public async Task <IDownloadedPackInfo> DownloadPackageAsync(IPackInfo packinfo) { string downloadUrl = string.Format(DownloadUrlFormat, packinfo.Id, packinfo.Version); string packageFileName = string.Format(DownloadPackageFileNameFormat, packinfo.Id, packinfo.Version); string outputPackageFileNameFullPath = Path.Combine(_packageTempPath, packageFileName); try { using (HttpClient client = new HttpClient()) { byte[] packageBytes = await client.GetByteArrayAsync(downloadUrl).ConfigureAwait(false); File.WriteAllBytes(outputPackageFileNameFullPath, packageBytes); return(new NugetPackInfo() { Id = packinfo.Id, Version = packinfo.Version, Path = outputPackageFileNameFullPath, TotalDownloads = packinfo.TotalDownloads }); } } catch (Exception e) { Console.WriteLine($"Failed to download package {packinfo.Id} {packinfo.Version}, reason: {e.ToString()}."); return(null); } }
internal void HandleOpenedPack(MindVision mindVision, IMemoryUpdate result) { var openedPack = mindVision.GetOpenedPack(); if (openedPack != null && !openedPack.Equals(lastOpenedPack) && isInit) { result.HasUpdates = true; result.OpenedPack = openedPack; lastOpenedPack = openedPack; } isInit = true; }