public static DugiteReleaseManifest Load(SPath path, IEnvironment environment) { var manifest = path.ReadAllText().FromJson <DugiteReleaseManifest>(true, false); var(zipAsset, shaAsset) = manifest.GetAsset(environment); var shaAssetPath = environment.UserCachePath.Combine("downloads", shaAsset.Name); if (!shaAssetPath.FileExists()) { var downloader = new Downloader(); downloader.QueueDownload(shaAsset.Url, shaAssetPath.Parent, shaAssetPath.FileName); var shaFile = downloader.RunSynchronously().FirstOrDefault(); } zipAsset.Hash = shaAssetPath.ReadAllText(); manifest.DugitePackage = zipAsset; return(manifest); }
public static DugiteReleaseManifest Load(ITaskManager taskManager, SPath manifestFile, SPath userCachePath, IGitEnvironment environment) { var manifest = manifestFile.ReadAllText().FromJson <DugiteReleaseManifest>(true, false); var(zipAsset, shaAsset) = manifest.GetAsset(environment); var shaAssetPath = userCachePath.Combine("downloads", shaAsset.Name); if (!shaAssetPath.FileExists()) { var downloader = new Downloader(taskManager); downloader.QueueDownload(shaAsset.Url, shaAssetPath.Parent, shaAssetPath.FileName); downloader.RunSynchronously(); } zipAsset.Hash = shaAssetPath.ReadAllText(); manifest.DugitePackage = zipAsset; return(manifest); }
public static Index Load(SPath indexFile) => indexFile.ReadAllText().FromJson <Index>(true, false);