public static string CreateRepository(OpenApiOptions options) { string zipFilePath = Path.Combine(options.OutputDir, "arcade.zip"); string repositoryDirectory = Path.Combine(options.OutputDir, options.SolutionName); string solutionFilePath = Path.Combine(repositoryDirectory, $"{options.SolutionName}.sln"); SlowlyRemoveAndRecreateDirectory(repositoryDirectory); RepositoryDownloader.DownloadFile(DownloadUrls.Arcade, zipFilePath); RepositoryExpander.ExpandFile(zipFilePath, repositoryDirectory); Directory.Delete( Path.Combine(repositoryDirectory, "src", "ArcadeRepo"), true); File.Delete( Path.Combine(repositoryDirectory, "ArcadeRepo.sln")); var replacements = Replacer.Create(options); Process(repositoryDirectory, replacements); return(Path.Combine(repositoryDirectory, "src")); }
public static void ExpandFile(string zipFile, string outputDirectory) { RepositoryDownloader.DownloadFile(DownloadUrls.Arcade, zipFile); string tempZipDir = Path.Combine(Path.GetDirectoryName(zipFile), Path.GetFileNameWithoutExtension(zipFile)); ZipFile.ExtractToDirectory(zipFile, tempZipDir); var firstDirectory = Directory.GetDirectories(tempZipDir).SingleOrDefault(); if (firstDirectory != null) { CopyDirectory(firstDirectory, outputDirectory, true, true); } if (File.Exists(zipFile)) { File.Delete(zipFile); } if (Directory.Exists(tempZipDir)) { Directory.Delete(tempZipDir, true); } }