internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue) { typedValue = null; Exception exception = numeric10FacetsChecker.CheckLexicalFacets(ref s, this); if (exception == null) { byte num; exception = XmlConvert.TryToByte(s, out num); if (exception == null) { exception = numeric10FacetsChecker.CheckValueFacets((short)num, this); if (exception == null) { typedValue = num; return(null); } } } return(exception); }
internal override Exception TryParseValue(object value, XmlNameTable nameTable, IXmlNamespaceResolver namespaceResolver, out object typedValue) { Exception exception; if (value == null) { throw new ArgumentNullException("value"); } string s = value as string; typedValue = null; if (s != null) { return(this.TryParseValue(s, nameTable, namespaceResolver, out typedValue)); } try { object obj2 = this.ValueConverter.ChangeType(value, this.ValueType, namespaceResolver); Array array = obj2 as Array; bool hasLexicalFacets = this.itemType.HasLexicalFacets; bool hasValueFacets = this.itemType.HasValueFacets; System.Xml.Schema.FacetsChecker facetsChecker = this.itemType.FacetsChecker; XmlValueConverter valueConverter = this.itemType.ValueConverter; for (int i = 0; i < array.Length; i++) { object obj3 = array.GetValue(i); if (hasLexicalFacets) { string parseString = (string)valueConverter.ChangeType(obj3, typeof(string), namespaceResolver); exception = facetsChecker.CheckLexicalFacets(ref parseString, this.itemType); if (exception != null) { return(exception); } } if (hasValueFacets) { exception = facetsChecker.CheckValueFacets(obj3, this.itemType); if (exception != null) { return(exception); } } } if (this.HasLexicalFacets) { string str3 = (string)this.ValueConverter.ChangeType(obj2, typeof(string), namespaceResolver); exception = DatatypeImplementation.listFacetsChecker.CheckLexicalFacets(ref str3, this); if (exception != null) { return(exception); } } if (this.HasValueFacets) { exception = DatatypeImplementation.listFacetsChecker.CheckValueFacets(obj2, this); if (exception != null) { return(exception); } } typedValue = obj2; return(null); } catch (FormatException exception2) { exception = exception2; } catch (InvalidCastException exception3) { exception = exception3; } catch (OverflowException exception4) { exception = exception4; } catch (ArgumentException exception5) { exception = exception5; } return(exception); }