public async Task DownloadAsync(string moduleName, string outputFolder, string version, string gitHubAbpLocalRepositoryPath, string gitHubVoloLocalRepositoryPath, AbpCommandLineOptions options) { Logger.LogInformation("Downloading source code of " + moduleName); Logger.LogInformation("Version: " + version); Logger.LogInformation("Output folder: " + outputFolder); var result = await ModuleProjectBuilder.BuildAsync( new ProjectBuildArgs( SolutionName.Parse(moduleName), moduleName, version, DatabaseProvider.NotSpecified, DatabaseManagementSystem.NotSpecified, UiFramework.NotSpecified, null, false, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, null, options ) ); using (var templateFileStream = new MemoryStream(result.ZipContent)) { using (var zipInputStream = new ZipInputStream(templateFileStream)) { var zipEntry = zipInputStream.GetNextEntry(); while (zipEntry != null) { if (IsAngularTestFile(zipEntry.Name)) { zipEntry = zipInputStream.GetNextEntry(); continue; } var fullZipToPath = Path.Combine(outputFolder, zipEntry.Name); var directoryName = Path.GetDirectoryName(fullZipToPath); if (!string.IsNullOrEmpty(directoryName)) { Directory.CreateDirectory(directoryName); } var fileName = Path.GetFileName(fullZipToPath); if (fileName.Length == 0) { zipEntry = zipInputStream.GetNextEntry(); continue; } var buffer = new byte[4096]; // 4K is optimum using (var streamWriter = File.Create(fullZipToPath)) { StreamUtils.Copy(zipInputStream, streamWriter, buffer); } zipEntry = zipInputStream.GetNextEntry(); } } } Logger.LogInformation($"'{moduleName}' has been successfully downloaded to '{outputFolder}'"); }
public CommandLineArgs([CanBeNull] string command = null, [CanBeNull] string target = null) { Command = command; Target = target; Options = new AbpCommandLineOptions(); }