protected virtual DirectoryInfo CreatePackageDirectory(Category category, DirectoryInfo directory, IPackageTree packageTree) { var newDirectory = new DirectoryInfo(Path.Combine(directory.FullName, category.Name)); fileSystemProvider.CreateDirectory(newDirectory.FullName); if (packageTree.IsBuildNode) { foreach (var package in category.Packages) { hasRanOnce = true; try { BuildAndZipPackage(rootPackageTree, fileSystemProvider, package, newDirectory, dropDirectory); } catch (Exception ex) { log.Error(ex); package.IsError = true; package.ErrorMessage = ex.UnwrapException(); CreateErrorTextFile(ex, package, newDirectory); } } } return(newDirectory); }
// CreateDirectory(buffer<bytes<0x301>, 0x19, 0x301> path) public long CreateDirectory(ServiceCtx context) { string name = ReadUtf8String(context); string dirName = _provider.GetFullPath(name); if (dirName == null) { return(MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist)); } if (_provider.DirectoryExists(dirName)) { return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists)); } if (IsPathAlreadyInUse(dirName)) { return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse)); } _provider.CreateDirectory(dirName); return(0); }
// CreateDirectory(buffer<bytes<0x301>, 0x19, 0x301> path) public long CreateDirectory(ServiceCtx Context) { string Name = ReadUtf8String(Context); string DirName = Provider.GetFullPath(Name); if (DirName == null) { return(MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist)); } if (Provider.DirectoryExists(DirName)) { return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists)); } if (IsPathAlreadyInUse(DirName)) { return(MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse)); } Provider.CreateDirectory(DirName); return(0); }
public string Convert(string file, ImageSize imageSize, string saveLocation) { string outputSaveLocation = GetOutputLocation(file, saveLocation); fileSystemProvider.CreateDirectory(outputSaveLocation); string saveFile = GetFileSaveLocation(file, outputSaveLocation, imageSize); SvgDocument svgDocument = GetDocument(file); Size size = OrientSize(imageSize.ToSize(), svgDocument); bitmapWrapper.CreatePNG(saveFile, svgDocument, size); return(saveFile); }
public async Task <string> SaveFileAsync(IFormFile image, CancellationToken cancellationToken) { string path = Path.Combine(_environment.WebRootPath, "Resourses", "Products"); if (!_fileProvider.Exists(path)) { _fileProvider.CreateDirectory(path); } string fileExtencion = Path.GetExtension(image.FileName); string fileName = Path.GetFileName(Guid.NewGuid().ToString() + '.' + fileExtencion); using (Stream stream = _fileStreamFactory.CreateFileStream(Path.Combine(path, fileName), FileMode.Create)) { await image.CopyToAsync(stream, cancellationToken); } return("/Resourses/Products/" + fileName); }