private static void ValidateBackgroundImage(ExpressionInfo backgroundImageSource, ExpressionInfo backgroundImageValue, ExpressionInfo backgroundImageMIMEType, Style style, ObjectType objectType, string objectName, ErrorContext errorContext) { if (backgroundImageSource != null) { bool flag = true; Global.Tracer.Assert(ExpressionInfo.Types.Constant == backgroundImageSource.Type); Image.SourceType intValue = (Image.SourceType)backgroundImageSource.IntValue; Global.Tracer.Assert(null != backgroundImageValue); if (Image.SourceType.Database == intValue && ExpressionInfo.Types.Constant == backgroundImageValue.Type) { errorContext.Register(ProcessingErrorCode.rsBinaryConstant, Severity.Error, objectType, objectName, "BackgroundImageValue"); flag = false; } if (Image.SourceType.Database == intValue && !PublishingValidator.ValidateMimeType(backgroundImageMIMEType, objectType, objectName, "BackgroundImageMIMEType", errorContext)) { flag = false; } if (flag) { style.AddAttribute("BackgroundImageSource", backgroundImageSource); style.AddAttribute("BackgroundImageValue", backgroundImageValue); if (Image.SourceType.Database == intValue) { style.AddAttribute("BackgroundImageMIMEType", backgroundImageMIMEType); } } } }
public static bool ValidateMimeType(ExpressionInfo mimeType, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { if (mimeType == null) { errorContext.Register(ProcessingErrorCode.rsMissingMIMEType, Severity.Error, objectType, objectName, propertyName); return(false); } if (ExpressionInfo.Types.Constant == mimeType.Type) { return(PublishingValidator.ValidateMimeType(mimeType.Value, objectType, objectName, propertyName, errorContext)); } return(true); }