示例#1
0
        public static UnpkgJsonEntry Create(string packageName, DistFile file)
        {
            var entry = new UnpkgJsonEntry
            {
                PackageName = packageName,
                Version     = file.BaseUrl,
                Files       = new List <UnpkgJsonFile>()
            };

            AddFiles(entry.Files, file.Files);
            return(entry);
        }
示例#2
0
        private static async Task DownloadFile(string package, string basePath, DistFile file)
        {
            basePath = basePath.TrimSlashes();
            var path         = file.Path.TrimSlashes();
            var pathSegments = path.Split('/');

            if (basePath.Split('/').LastOrDefault() == pathSegments.FirstOrDefault())
            {
                path = string.Join("/", pathSegments.Skip(1));
            }
            var(cdn, localPath) = await Download.DistFile(package, $"{basePath}/{path}");

            file.Url       = cdn;
            file.LocalPath = localPath.Replace(Path.DirectorySeparatorChar, '/');
        }