Пример #1
0
        public DisposableFile CreateJsonFrom(DotNetTool model)
        {
            var directory = directoryBuilder.CreateFolderInCurrentDirectory();
            var jsonData  = jsonSerializer.Serialize(model);
            var fileInfo  = fileService.GetFileInfo(Path.Combine(directory.FullName, fileSettings.JsonDataFileName));

            fileInfo.WriteAllText(jsonData);
            return(new DisposableFile(fileInfo));
        }
Пример #2
0
        public async Task <byte[]> GetDotnetToolAsync(DotNetTool data, string consoleParameter = "")
        {
            using var jsonFile = jsonFileCreatorService.CreateJsonFrom(data);
            var zipName = Path.Combine(jsonFile.FileInfo.Directory.FullName, $"{data.ProjectName}s.zip");

            await dotNetToolExecutor.ExecuteAsync(consoleParameter, jsonFile, zipName).ConfigureAwait(false);

            var file = await File.ReadAllBytesAsync(zipName).ConfigureAwait(false);

            cleanupService.CleanUp(data);

            return(file);
        }
Пример #3
0
 public async Task <ActionResult> CreateUnsafe(DotNetTool toolData)
 {
     return(File(await dotnetToolBuilderService.GetDotnetToolAsync(toolData, "-fm").ConfigureAwait(false), MediaTypeNames.Application.Octet, toolData.ProjectName + ".zip"));
 }
 public void CleanUp(DotNetTool data)
 {
     //To be deleted when Toolbuilder is updated
     Directory.Delete(Path.Combine(Directory.GetCurrentDirectory(), data.ProjectName), true);
 }