private static void EnsureFileMetadataIsValid(IElementDescriptor elementDescriptor, Language language, IUploadedFileMetadata uploadedFileMetadata) { var constraints = (IBinaryElementConstraints)elementDescriptor.Constraints.For(language); if (constraints.MaxFilenameLength < uploadedFileMetadata.FileName.Length) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new FilenameTooLongError(uploadedFileMetadata.FileName.Length)); } if (constraints.MaxSize < uploadedFileMetadata.FileLength) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new BinaryTooLargeError(uploadedFileMetadata.FileLength)); } if (constraints is CompositeBitmapImageElementConstraints compositeBitmapImageElementConstraints && uploadedFileMetadata.FileType == FileType.SizeSpecificBitmapImage && compositeBitmapImageElementConstraints.SizeSpecificImageMaxSize < uploadedFileMetadata.FileLength) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new SizeSpecificImageTooLargeError(uploadedFileMetadata.FileLength)); } var extension = GetDotLessExtension(uploadedFileMetadata.FileName); if (!ValidateFileExtension(extension, constraints)) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new BinaryInvalidFormatError(extension)); } }
bool MoveToElement(IElementDescriptor element) { if (element != null) { _state = new NavigatorState(element); return(true); } return(false); }
public MultipartUploadSession(Guid sessionId, SessionDescriptor sessionDescriptor, DateTime expiresAt, IElementDescriptor elementDescriptor, string fileKey, string fileName, string uploadId) { SessionId = sessionId; SessionDescriptor = sessionDescriptor; ElementDescriptor = elementDescriptor; FileKey = fileKey; FileName = fileName; UploadId = uploadId; SessionExpiresAt = expiresAt; }
public MultipartUploadSession( Guid sessionId, SessionDescriptor sessionDescriptor, DateTime expiresAt, IElementDescriptor elementDescriptor, IUploadedFileMetadata uploadedFileMetadata, string fileKey, string uploadId) { SessionId = sessionId; SessionDescriptor = sessionDescriptor; ElementDescriptor = elementDescriptor; UploadedFileMetadata = uploadedFileMetadata; FileKey = fileKey; UploadId = uploadId; SessionExpiresAt = expiresAt; }
private static void EnsureFileMetadataIsValid(IElementDescriptor elementDescriptor, long inputStreamLength, Language language, string fileName) { var constraints = (IBinaryElementConstraints)elementDescriptor.Constraints.For(language); if (constraints.MaxFilenameLength < fileName.Length) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new FilenameTooLongError(fileName.Length)); } if (constraints.MaxSize < inputStreamLength) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new BinaryTooLargeError(inputStreamLength)); } var extension = GetDotLessExtension(fileName); if (!ValidateFileExtension(extension, constraints)) { throw new InvalidBinaryException(elementDescriptor.TemplateCode, new BinaryInvalidFormatError(extension)); } }
public ObjectElementPersistenceDescriptor(IElementDescriptor elementDescriptor, IObjectElementValue value) { _elementDescriptor = elementDescriptor; Value = value; }
public ObjectNavigator(IElementDescriptor element) { _state = new NavigatorState(element); _nameTable.Add(element.Name); }
public NavigatorState(IElementDescriptor element) { Element = element; NodeType = XPathNodeType.Element; }