private static bool ValidateSize(string size, bool allowNegative, double minValue, double maxValue, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext, out double validSizeInMM, out string newSize) { validSizeInMM = minValue; newSize = minValue + "mm"; RVUnit sizeValue = default(RVUnit); if (!Validator.ValidateSizeString(size, out sizeValue)) { errorContext.Register(ProcessingErrorCode.rsInvalidSize, Severity.Error, objectType, objectName, propertyName, size); return(false); } if (!Validator.ValidateSizeUnitType(sizeValue)) { errorContext.Register(ProcessingErrorCode.rsInvalidMeasurementUnit, Severity.Error, objectType, objectName, propertyName, sizeValue.Type.ToString()); return(false); } if (!allowNegative && !Validator.ValidateSizeIsPositive(sizeValue)) { errorContext.Register(ProcessingErrorCode.rsNegativeSize, Severity.Error, objectType, objectName, propertyName); return(false); } RVUnit unit = new RVUnit(Math.Round(sizeValue.Value, Validator.DecimalPrecision), sizeValue.Type); double num = Converter.ConvertToMM(unit); if (!Validator.ValidateSizeValue(num, minValue, maxValue)) { errorContext.Register(ProcessingErrorCode.rsOutOfRangeSize, Severity.Error, objectType, objectName, propertyName, size, Converter.ConvertSize(minValue), Converter.ConvertSize(maxValue)); return(false); } validSizeInMM = Math.Round(num, Validator.DecimalPrecision); newSize = unit.ToString(CultureInfo.InvariantCulture); return(true); }
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 void ValidateCalendar(CultureInfo language, string calendar, ObjectType objectType, string ObjectName, string propertyName, ErrorContext errorContext) { if (!Validator.ValidateCalendar(language, calendar)) { errorContext.Register(ProcessingErrorCode.rsInvalidCalendarForLanguage, Severity.Error, objectType, ObjectName, propertyName, calendar, language.Name); } }
public static void ValidateNumeralVariant(CultureInfo language, int numVariant, ObjectType objectType, string ObjectName, string propertyName, ErrorContext errorContext) { if (!Validator.ValidateNumeralVariant(language, numVariant)) { errorContext.Register(ProcessingErrorCode.rsInvalidNumeralVariantForLanguage, Severity.Error, objectType, ObjectName, propertyName, numVariant.ToString(CultureInfo.InvariantCulture), language.Name); } }
public void MergeCollationSettings(ErrorContext errorContext, string dataSourceType, string cultureName, bool caseSensitive, bool accentSensitive, bool kanatypeSensitive, bool widthSensitive) { if (this.NeedAutoDetectCollation()) { uint lcid = DataSetValidator.LOCALE_SYSTEM_DEFAULT; if (cultureName != null) { try { CultureInfo cultureInfo = CultureInfo.GetCultureInfo(cultureName); lcid = (uint)cultureInfo.LCID; } catch (Exception) { errorContext.Register(ProcessingErrorCode.rsInvalidCollationCultureName, Severity.Warning, ObjectType.DataSet, this.m_name, dataSourceType, cultureName); } } if (DataSetValidator.LOCALE_SYSTEM_DEFAULT == this.m_lcid) { this.m_lcid = lcid; } this.MergeSensitivity(ref this.m_accentSensitivity, accentSensitive); this.MergeSensitivity(ref this.m_caseSensitivity, caseSensitive); this.MergeSensitivity(ref this.m_kanatypeSensitivity, kanatypeSensitive); this.MergeSensitivity(ref this.m_widthSensitivity, widthSensitive); } }
public static bool ValidateColumns(int columns, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { if (!Validator.ValidateColumns(columns)) { errorContext.Register(ProcessingErrorCode.rsInvalidColumnsInBody, Severity.Error, objectType, objectName, propertyName); return(false); } return(true); }
public static string ValidateMimeType(string mimeType, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { if (Validator.ValidateMimeType(mimeType)) { return(mimeType); } errorContext.Register(ProcessingErrorCode.rsInvalidMIMEType, Severity.Warning, objectType, objectName, propertyName, mimeType); return(null); }
public static bool ValidateCalendar(CultureInfo language, Calendars calendarType, ObjectType objectType, string ObjectName, string propertyName, ErrorContext errorContext) { if (!Validator.ValidateCalendar(language, calendarType)) { errorContext.Register(ProcessingErrorCode.rsInvalidCalendarForLanguage, Severity.Error, objectType, ObjectName, propertyName, calendarType.ToString(), language.Name); return(false); } return(true); }
public static bool ValidateMimeType(string mimeType, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { if (!Validator.ValidateMimeType(mimeType)) { errorContext.Register(ProcessingErrorCode.rsInvalidMIMEType, Severity.Error, objectType, objectName, propertyName, mimeType); return(false); } return(true); }
public void Parse(string name, List <string> defaultValues, string type, string nullable, string prompt, string promptUser, string allowBlank, string multiValue, string usedInQuery, bool hidden, ErrorContext errorContext, CultureInfo language) { base.Parse(name, defaultValues, type, nullable, prompt, promptUser, allowBlank, multiValue, usedInQuery, hidden, errorContext, language); if (hidden) { this.m_prompt = ""; } else if (prompt == null) { this.m_prompt = name + ":"; } else { this.m_prompt = prompt; } if (this.m_validValuesValueExpressions == null) { return; } if (DataType.Boolean == base.DataType) { return; } int num = this.m_validValuesValueExpressions.Count - 1; while (true) { if (num >= 0) { ExpressionInfo expressionInfo = this.m_validValuesValueExpressions[num]; if (expressionInfo == null && base.MultiValue) { this.m_validValuesValueExpressions.RemoveAt(num); } else if (expressionInfo != null && ExpressionInfo.Types.Constant == expressionInfo.Type) { object newValue = default(object); if (!ParameterBase.CastFromString(expressionInfo.Value, out newValue, base.DataType, language)) { if (errorContext == null) { break; } errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, base.ParameterObjectType, name, "ValidValue"); } else { base.ValidateValue(newValue, errorContext, base.ParameterObjectType, "ValidValue"); } } num--; continue; } return; } throw new ReportParameterTypeMismatchException(name); }
private static bool ValidateEmbeddedImageName(string embeddedImageName, EmbeddedImageHashtable embeddedImages, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { if (!Validator.ValidateEmbeddedImageName(embeddedImageName, embeddedImages)) { errorContext.Register(ProcessingErrorCode.rsInvalidEmbeddedImageProperty, Severity.Error, objectType, objectName, propertyName, embeddedImageName); return(false); } return(true); }
private static bool ValidateNumeralVariant(ExpressionInfo numeralVariant, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != numeralVariant); if (ExpressionInfo.Types.Constant == numeralVariant.Type && !Validator.ValidateNumeralVariant(numeralVariant.IntValue)) { errorContext.Register(ProcessingErrorCode.rsInvalidNumeralVariant, Severity.Error, objectType, objectName, propertyName, numeralVariant.IntValue.ToString(CultureInfo.InvariantCulture)); return(false); } return(true); }
private static bool ValidateFontWeight(ExpressionInfo fontWeight, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != fontWeight); if (ExpressionInfo.Types.Constant == fontWeight.Type && !Validator.ValidateFontWeight(fontWeight.Value)) { errorContext.Register(ProcessingErrorCode.rsInvalidFontWeight, Severity.Error, objectType, objectName, propertyName, fontWeight.Value); return(false); } return(true); }
private static bool ValidateWritingMode(ExpressionInfo writingMode, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != writingMode); if (ExpressionInfo.Types.Constant == writingMode.Type && !Validator.ValidateWritingMode(writingMode.Value)) { errorContext.Register(ProcessingErrorCode.rsInvalidWritingMode, Severity.Error, objectType, objectName, propertyName, writingMode.Value); return(false); } return(true); }
private static bool ValidateUnicodeBiDi(ExpressionInfo unicodeBiDi, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != unicodeBiDi); if (ExpressionInfo.Types.Constant == unicodeBiDi.Type && !Validator.ValidateUnicodeBiDi(unicodeBiDi.Value)) { errorContext.Register(ProcessingErrorCode.rsInvalidUnicodeBiDi, Severity.Error, objectType, objectName, propertyName, unicodeBiDi.Value); return(false); } return(true); }
private static bool ValidateCalendar(ExpressionInfo calendar, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != calendar); if (ExpressionInfo.Types.Constant == calendar.Type && !Validator.ValidateCalendar(calendar.Value)) { errorContext.Register(ProcessingErrorCode.rsInvalidCalendar, Severity.Error, objectType, objectName, propertyName, calendar.Value); return(false); } return(true); }
private static bool ValidateBackgroundRepeat(ExpressionInfo repeat, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != repeat); if (ExpressionInfo.Types.Constant == repeat.Type && !Validator.ValidateBackgroundRepeat(repeat.Value)) { errorContext.Register(ProcessingErrorCode.rsInvalidBackgroundRepeat, Severity.Error, objectType, objectName, propertyName, repeat.Value); return(false); } return(true); }
private static bool ValidateDirection(ExpressionInfo direction, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != direction); if (ExpressionInfo.Types.Constant == direction.Type && !Validator.ValidateDirection(direction.Value)) { errorContext.Register(ProcessingErrorCode.rsInvalidDirection, Severity.Error, objectType, objectName, propertyName, direction.Value); return(false); } return(true); }
public static bool ValidateSpecificLanguage(ExpressionInfo language, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext, out CultureInfo culture) { culture = null; Global.Tracer.Assert(null != language); if (ExpressionInfo.Types.Constant == language.Type && !Validator.ValidateSpecificLanguage(language.Value, out culture)) { errorContext.Register(ProcessingErrorCode.rsInvalidLanguage, Severity.Error, objectType, objectName, propertyName, language.Value); return(false); } return(true); }
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); }
public static string ValidateEmbeddedImageName(string embeddedImageName, EmbeddedImageHashtable embeddedImages, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { if (embeddedImageName == null) { return(null); } if (!Validator.ValidateEmbeddedImageName(embeddedImageName, embeddedImages)) { errorContext.Register(ProcessingErrorCode.rsInvalidEmbeddedImageProperty, Severity.Warning, objectType, objectName, propertyName, embeddedImageName); return(null); } return(embeddedImageName); }
public static string ValidateReportName(ICatalogItemContext reportContext, string reportName, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != reportName); if (reportName.StartsWith(Uri.UriSchemeHttp + Uri.SchemeDelimiter, StringComparison.OrdinalIgnoreCase) || reportName.StartsWith(Uri.UriSchemeHttps + Uri.SchemeDelimiter, StringComparison.OrdinalIgnoreCase)) { try { new Uri(reportName); } catch (UriFormatException) { errorContext.Register(ProcessingErrorCode.rsInvalidReportUri, Severity.Error, objectType, objectName, propertyName); return(reportName); } } else if (reportName.Length > 0 && -1 != reportName.IndexOfAny(PublishingValidator.m_invalidCharacters.ToCharArray())) { errorContext.Register(ProcessingErrorCode.rsInvalidReportNameCharacters, Severity.Error, objectType, objectName, propertyName, PublishingValidator.m_invalidCharacters); return(reportName); } string text; try { text = reportContext.AdjustSubreportOrDrillthroughReportPath(reportName.Trim()); } catch (RSException) { errorContext.Register(ProcessingErrorCode.rsInvalidReportUri, Severity.Error, objectType, objectName, propertyName); return(reportName); } if (text != null && reportName.Length != 0) { return(text); } errorContext.Register((ProcessingErrorCode)((reportName.Length == 0) ? 151 : 153), Severity.Error, objectType, objectName, propertyName); return(reportName); }
public void AddValidValue(string paramValue, string paramLabel, ErrorContext errorContext, CultureInfo language) { object paramValue2 = default(object); if (!ParameterBase.CastFromString(paramValue, out paramValue2, base.DataType, language)) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, ObjectType.ReportParameter, base.Name, "ValidValue"); return; } throw new ReportParameterTypeMismatchException(base.Name); } this.AddValidValueExplicit(paramValue2, paramLabel); }
public static bool ValidateValueForNull(object newValue, bool nullable, ErrorContext errorContext, ObjectType parameterType, string parameterName, string parameterValueProperty) { bool result = true; bool flag = errorContext is PublishingErrorContext; if (newValue == null && !nullable) { result = false; if (errorContext != null) { errorContext.Register((ProcessingErrorCode)(flag ? 188 : 187), (Severity)((!flag) ? 1 : 0), parameterType, parameterName, "Nullable", parameterValueProperty); } } return(result); }
private static bool ValidateColor(ExpressionInfo color, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != color); if (ExpressionInfo.Types.Constant == color.Type) { string value = default(string); if (!Validator.ValidateColor(color.Value, out value, objectType == ObjectType.Chart)) { errorContext.Register(ProcessingErrorCode.rsInvalidColor, Severity.Error, objectType, objectName, propertyName, color.Value); return(false); } color.Value = value; } return(true); }
private static bool ValidateBorderStyle(ExpressionInfo borderStyle, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(null != borderStyle); if (ExpressionInfo.Types.Constant == borderStyle.Type) { string value = default(string); if (!Validator.ValidateBorderStyle(borderStyle.Value, out value)) { errorContext.Register(ProcessingErrorCode.rsInvalidBorderStyle, Severity.Error, objectType, objectName, propertyName, borderStyle.Value); return(false); } if (ObjectType.Line == objectType) { borderStyle.Value = value; } } return(true); }
public bool ValidateValueForBlank(object newValue, ErrorContext errorContext, string parameterValueProperty) { bool result = true; bool flag = errorContext is PublishingErrorContext; if (this.DataType == DataType.String && !this.AllowBlank) { string a = (string)newValue; if (a == string.Empty) { result = false; if (errorContext != null) { errorContext.Register((ProcessingErrorCode)(flag ? 188 : 187), (Severity)((!flag) ? 1 : 0), ObjectType.ReportParameter, this.m_name, "AllowBlank", parameterValueProperty); } } } return(result); }
private void ResolveAssemblylocations(StringList codeModules, CompilerParameters options, ErrorContext errorContext, AppDomain compilationTempAppDomain) { AssemblyLocationResolver assemblyLocationResolver = AssemblyLocationResolver.CreateResolver(compilationTempAppDomain); for (int num = codeModules.Count - 1; num >= 0; num--) { try { options.ReferencedAssemblies.Add(assemblyLocationResolver.LoadAssemblyAndResolveLocation(codeModules[num])); } catch (Exception ex) { ProcessingMessage processingMessage = errorContext.Register(ProcessingErrorCode.rsErrorLoadingCodeModule, Severity.Error, ObjectType.Report, null, null, codeModules[num], ex.Message); if (Global.Tracer.TraceError && processingMessage != null) { Global.Tracer.Trace(TraceLevel.Error, processingMessage.Message + Environment.NewLine + ex.ToString()); } } } }
public void Parse(string name, List <string> defaultValues, string type, string nullable, string prompt, bool promptIsExpr, string promptUser, string allowBlank, string multiValue, ValidValueList validValues, string usedInQuery, bool hidden, ErrorContext errorContext, CultureInfo language) { base.Parse(name, defaultValues, type, nullable, prompt, promptUser, allowBlank, multiValue, usedInQuery, hidden, errorContext, language); if (hidden) { this.m_prompt = ""; } else if (prompt == null) { this.m_prompt = name + ":"; } else { this.m_prompt = prompt; } this.DynamicPrompt = promptIsExpr; if (validValues != null) { int count = validValues.Count; for (int i = 0; i < count; i++) { object obj = default(object); if (!ParameterBase.CastFromString(validValues[i].StringValue, out obj, base.DataType, language)) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, ObjectType.ReportParameter, name, "ValidValue"); continue; } throw new ReportParameterTypeMismatchException(name); } validValues[i].Value = obj; base.ValidateValue(obj, errorContext, base.ParameterObjectType, "ValidValue"); } this.m_validValues = validValues; } }
public virtual void Parse(string name, List <string> defaultValues, string type, string nullable, object prompt, string promptUser, string allowBlank, string multiValue, string usedInQuery, bool hidden, ErrorContext errorContext, CultureInfo language) { if (name != null && name.Length != 0) { this.m_name = name; if (type != null && type.Length != 0) { try { this.m_dataType = (DataType)Enum.Parse(typeof(DataType), type, true); } catch (ArgumentException) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, ObjectType.Parameter, name, "DataType"); goto end_IL_0050; } throw new ElementTypeMismatchException("Type"); end_IL_0050 :; } } else { this.m_dataType = DataType.String; } if (nullable != null && nullable.Length != 0) { try { this.m_nullable = bool.Parse(nullable); } catch (FormatException) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, this.ParameterObjectType, name, "Nullable"); goto end_IL_00a5; } throw new ElementTypeMismatchException("Nullable"); end_IL_00a5 :; } } else { this.m_nullable = false; } if (allowBlank != null && allowBlank.Length != 0) { try { this.m_allowBlank = bool.Parse(allowBlank); } catch (FormatException) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, this.ParameterObjectType, name, "AllowBlank"); goto end_IL_00fe; } throw new ElementTypeMismatchException("AllowBlank"); end_IL_00fe :; } } else { this.m_allowBlank = false; } if (multiValue != null && multiValue.Length != 0 && this.m_dataType != DataType.Boolean) { try { this.m_multiValue = bool.Parse(multiValue); } catch (FormatException) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, this.ParameterObjectType, name, "MultiValue"); goto end_IL_0160; } throw new ElementTypeMismatchException("MultiValue"); end_IL_0160 :; } } else { this.m_multiValue = false; } if (promptUser != null && !(promptUser == string.Empty)) { try { this.m_promptUser = bool.Parse(promptUser); } catch (FormatException) { throw new ElementTypeMismatchException("PromptUser"); } } else if (prompt == null) { this.m_promptUser = false; } else { this.m_promptUser = true; } if (defaultValues == null) { this.m_defaultValues = null; } else { int count = defaultValues.Count; this.m_defaultValues = new object[count]; object obj = default(object); for (int i = 0; i < count; this.m_defaultValues[i] = obj, i++) { if (!ParameterBase.CastFromString(defaultValues[i], out obj, this.m_dataType, language)) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, this.ParameterObjectType, name, "DefaultValue"); continue; } throw new ReportParameterTypeMismatchException(name); } this.ValidateValue(obj, errorContext, this.ParameterObjectType, "DefaultValue"); } } this.m_usedInQuery = true; if (usedInQuery != null && usedInQuery.Length != 0) { try { this.m_usedInQueryAsDefined = (UsedInQueryType)Enum.Parse(typeof(UsedInQueryType), usedInQuery, true); } catch (ArgumentException) { if (errorContext != null) { errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, this.ParameterObjectType, name, "MultiValue"); goto end_IL_02a3; } throw new ElementTypeMismatchException("UsedInQuery"); end_IL_02a3 :; } if (this.m_usedInQueryAsDefined == UsedInQueryType.False) { this.m_usedInQuery = false; } else if (this.m_usedInQueryAsDefined == UsedInQueryType.True) { this.m_usedInQuery = true; } } else { this.m_usedInQueryAsDefined = UsedInQueryType.Auto; } if (usedInQuery != null && usedInQuery.Length != 0) { try { this.m_usedInQueryAsDefined = (UsedInQueryType)Enum.Parse(typeof(UsedInQueryType), usedInQuery, true); } catch (ArgumentException) { throw new ElementTypeMismatchException("UsedInQuery"); } if (this.m_usedInQueryAsDefined == UsedInQueryType.False) { this.m_usedInQuery = false; } else if (this.m_usedInQueryAsDefined == UsedInQueryType.True) { this.m_usedInQuery = true; } } else { this.m_usedInQueryAsDefined = UsedInQueryType.Auto; } return; } throw new MissingElementException("Name"); }