public virtual void Validate(object state) { if (EOLDelimiter.IsNullOrEmpty()) { throw new ChoRecordConfigurationException("EOLDelimiter can't be null or empty."); } if (QuoteChar == ChoCharEx.NUL) { throw new ChoRecordConfigurationException("Invalid '{0}' quote character specified.".FormatString(QuoteChar)); } if (EOLDelimiter.Contains(QuoteChar)) { throw new ChoRecordConfigurationException("QuoteChar [{0}] can't be one EOLDelimiter characters [{1}]".FormatString(QuoteChar, EOLDelimiter)); } if (Comments != null) { if (Comments.Contains(EOLDelimiter)) { throw new ChoRecordConfigurationException("One of the Comments contains EOLDelimiter. Not allowed."); } else if (Comments.Where(c => c.IsNullOrWhiteSpace()).Any()) { throw new ChoRecordConfigurationException("One of the Comments contains Whitespace characters. Not allowed."); } } }
public override void Validate(object state) { base.Validate(state); if (EOLDelimiter.IsNullOrEmpty()) { throw new ChoRecordConfigurationException("EOLDelimiter can't be null or empty."); } if (QuoteChar == ChoCharEx.NUL) { throw new ChoRecordConfigurationException("Invalid '{0}' quote character specified.".FormatString(QuoteChar)); } if (EOLDelimiter.Contains(QuoteChar)) { throw new ChoRecordConfigurationException("QuoteChar [{0}] can't be one EOLDelimiter characters [{1}]".FormatString(QuoteChar, EOLDelimiter)); } if (NestedColumnSeparator != null) { if (NestedColumnSeparator.Value == ChoCharEx.NUL) { throw new ChoRecordConfigurationException("Invalid '{0}' nested column separator specified.".FormatString(NestedColumnSeparator)); } if (NestedColumnSeparator.Value == QuoteChar) { throw new ChoRecordConfigurationException("Nested column separator [{0}] can't be quote character [{1}]".FormatString(NestedColumnSeparator, QuoteChar)); } if (EOLDelimiter.Contains(NestedColumnSeparator.Value)) { throw new ChoRecordConfigurationException("Nested column separator [{0}] can't be one EOLDelimiter characters [{1}]".FormatString(NestedColumnSeparator, EOLDelimiter)); } } if (ArrayIndexSeparator != null) { if (ArrayIndexSeparator.Value == ChoCharEx.NUL) { throw new ChoRecordConfigurationException("Invalid '{0}' array index separator specified.".FormatString(ArrayIndexSeparator)); } if (ArrayIndexSeparator.Value == QuoteChar) { throw new ChoRecordConfigurationException("Array index separator [{0}] can't be quote character [{1}]".FormatString(ArrayIndexSeparator, QuoteChar)); } if (EOLDelimiter.Contains(ArrayIndexSeparator.Value)) { throw new ChoRecordConfigurationException("Array index separator [{0}] can't be one EOLDelimiter characters [{1}]".FormatString(ArrayIndexSeparator, EOLDelimiter)); } } if (Comments != null) { if (Comments.Contains(EOLDelimiter)) { throw new ChoRecordConfigurationException("One of the Comments contains EOLDelimiter. Not allowed."); } else if (Comments.Where(c => c.IsNullOrWhiteSpace()).Any()) { throw new ChoRecordConfigurationException("One of the Comments contains Whitespace characters. Not allowed."); } } }