public async Task<Manifest> Install(Manifest manifest, InstallablePackage entry, InstallSettings settings) { var relativePath = MakeRelative(manifest.FileName, settings.InstallDirectory); if (settings.SaveManifest) { var package = new ManifestPackage { Version = entry.Version, Path = relativePath }; // Only write "files" to the manifest if it's different from all files. if (entry.AllFiles.Count() != entry.Files.Count()) { package.Files = entry.Files; } manifest.Packages[entry.Name] = package; await manifest.Save(); } string cwd = new FileInfo(manifest.FileName).DirectoryName; OnInstalling(entry, settings.InstallDirectory); await CopyPackageContent(entry, settings); OnInstalled(entry, settings.InstallDirectory); return manifest; }
async Task InstallUrls(Manifest manifest, ManifestPackage package) { string dir = Path.GetDirectoryName(manifest.FileName); string path = Path.Combine(dir, package.Path).Replace("\\", "/"); var files = new List <string>(); var urlPackage = new UrlPackage { Name = package.Name, Files = files }; OnInstalling(manifest, urlPackage, path); foreach (string url in package.Urls) { string fileName = Path.GetFileName(url); string filePath = new FileInfo(Path.Combine(dir, package.Path, fileName)).FullName; Directory.CreateDirectory(Path.GetDirectoryName(filePath)); files.Add(fileName); using (WebClient client = new WebClient()) { OnCopying(url, filePath); await client.DownloadFileTaskAsync(url, filePath); OnCopied(url, filePath); } } OnInstalled(manifest, urlPackage, path); }
public async Task <Manifest> Install(Manifest manifest, InstallablePackage entry, InstallSettings settings) { var relativePath = MakeRelative(manifest.FileName, settings.InstallDirectory); if (settings.SaveManifest) { var package = new ManifestPackage { Version = entry.Version, Path = relativePath }; // Only write "files" to the manifest if it's different from all files. if (entry.AllFiles.Count() != entry.Files.Count()) { package.Files = entry.Files; } manifest.Packages[entry.Name] = package; await manifest.Save(); } string cwd = new FileInfo(manifest.FileName).DirectoryName; OnInstalling(manifest, entry, settings.InstallDirectory); var copied = await CopyPackageContent(entry, settings); // Check if the files where already installed. Skip if they were if (copied) { OnInstalled(manifest, entry, settings.InstallDirectory); } return(manifest); }
async Task InstallUrls(Manifest manifest, ManifestPackage package) { string dir = Path.GetDirectoryName(manifest.FileName); string path = Path.Combine(dir, package.Path).Replace("\\", "/"); var files = new List<string>(); var urlPackage = new UrlPackage { Name = package.Name, Files = files }; OnInstalling(manifest, urlPackage, path); foreach (string url in package.Urls) { string fileName = Path.GetFileName(url); string filePath = new FileInfo(Path.Combine(dir, package.Path, fileName)).FullName; Directory.CreateDirectory(Path.GetDirectoryName(filePath)); files.Add(fileName); using (WebClient client = new WebClient()) { OnCopying(url, filePath); await client.DownloadFileTaskAsync(url, filePath); OnCopied(url, filePath); } } OnInstalled(manifest, urlPackage, path); }