public async Task <int> OnExecute() { var armFilePath = PathHelper.ResolvePath(InputFile); using (StreamReader r = new StreamReader(armFilePath)) { var filePath = System.IO.Path.GetDirectoryName(armFilePath); if (!string.IsNullOrEmpty(Path)) { if (!Directory.Exists(Path)) { throw new Exception("FilePath does not exist"); } else { filePath = Path; } } var path = System.IO.Path.Combine(filePath, (string.IsNullOrEmpty(OutputName) ? ($"{System.IO.Path.GetFileNameWithoutExtension(armFilePath)}.parameter.json") : OutputName)); _fileHandler.Create(path, _armContext.Load(await r.ReadToEndAsync()).CreateParameterSchema(), Path, Override); } return((int)ExitCodes.Success); }
public async Task <Image> CreateImageAsync(Image image, Stream imageStream, User createUser) { _fileHandler.Create(image.RemoteFileName, imageStream); image.Id = await _fileRepository.InsertAndGetIdAsync(image); return(image); }