internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue) { typedValue = null; if ((s == null) || (s.Length == 0)) { return(new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty)); } Exception exception = DatatypeImplementation.durationFacetsChecker.CheckLexicalFacets(ref s, this); if (exception == null) { XsdDuration duration; exception = XsdDuration.TryParse(s, XsdDuration.DurationType.DayTimeDuration, out duration); if (exception == null) { TimeSpan span; exception = duration.TryToTimeSpan(XsdDuration.DurationType.DayTimeDuration, out span); if (exception == null) { exception = DatatypeImplementation.durationFacetsChecker.CheckValueFacets(span, this); if (exception == null) { typedValue = span; return(null); } } } } return(exception); }
public XsdDuration(TimeSpan timeSpan, DurationType durationType) { long ticks = timeSpan.Ticks; ulong ticksPos; bool isNegative; if (ticks < 0) { // Note that (ulong) -Int64.MinValue = Int64.MaxValue + 1, which is what we want for that special case isNegative = true; ticksPos = unchecked ((ulong)-ticks); } else { isNegative = false; ticksPos = (ulong)ticks; } if (durationType == DurationType.YearMonthDuration) { int years = (int)(ticksPos / ((ulong)TimeSpan.TicksPerDay * 365)); int months = (int)((ticksPos % ((ulong)TimeSpan.TicksPerDay * 365)) / ((ulong)TimeSpan.TicksPerDay * 30)); if (months == 12) { // If remaining days >= 360 and < 365, then round off to year years++; months = 0; } this = new XsdDuration(isNegative, years, months, 0, 0, 0, 0, 0); } else { Debug.Assert(durationType == DurationType.Duration || durationType == DurationType.DayTimeDuration); // Tick count is expressed in 100 nanosecond intervals _nanoseconds = (uint)(ticksPos % 10000000) * 100; if (isNegative) { _nanoseconds |= NegativeBit; } _years = 0; _months = 0; _days = (int)(ticksPos / (ulong)TimeSpan.TicksPerDay); _hours = (int)((ticksPos / (ulong)TimeSpan.TicksPerHour) % 24); _minutes = (int)((ticksPos / (ulong)TimeSpan.TicksPerMinute) % 60); _seconds = (int)((ticksPos / (ulong)TimeSpan.TicksPerSecond) % 60); } }
public XsdDuration(TimeSpan timeSpan, DurationType durationType) { ulong num2; bool flag; long ticks = timeSpan.Ticks; if (ticks < 0L) { flag = true; num2 = (ulong)-ticks; } else { flag = false; num2 = (ulong)ticks; } if (durationType == DurationType.YearMonthDuration) { int years = (int)(num2 / ((ulong)0x11ed178c6c000L)); int months = (int)((num2 % ((ulong)0x11ed178c6c000L)) / ((ulong)0x1792f8648000L)); if (months == 12) { years++; months = 0; } this = new XsdDuration(flag, years, months, 0, 0, 0, 0, 0); } else { this.nanoseconds = ((uint)(num2 % ((ulong)0x989680L))) * 100; if (flag) { this.nanoseconds |= 0x80000000; } this.years = 0; this.months = 0; this.days = (int)(num2 / ((ulong)0xc92a69c000L)); this.hours = (int)((num2 / ((ulong)0x861c46800L)) % ((ulong)0x18L)); this.minutes = (int)((num2 / ((ulong)0x23c34600L)) % ((ulong)60L)); this.seconds = (int)((num2 / ((ulong)0x989680L)) % ((ulong)60L)); } }
///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToTimeSpan"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static TimeSpan ToTimeSpan(string s) { XsdDuration duration; TimeSpan timeSpan; try { duration = new XsdDuration(s); } catch (Exception) { // Remap exception for v1 compatibility throw new FormatException(SR.Format(SR.XmlConvert_BadFormat, s, "TimeSpan")); } timeSpan = duration.ToTimeSpan(); return timeSpan; }
internal static Exception?TryParse(string s, DurationType durationType, out XsdDuration result) { string?errorCode; int length; int value, pos, numDigits; Parts parts = Parts.HasNone; result = default; s = s.Trim(); length = s.Length; pos = 0; numDigits = 0; if (pos >= length) { goto InvalidFormat; } if (s[pos] == '-') { pos++; result._nanoseconds = NegativeBit; } else { result._nanoseconds = 0; } if (pos >= length) { goto InvalidFormat; } if (s[pos++] != 'P') { goto InvalidFormat; } errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } if (s[pos] == 'Y') { if (numDigits == 0) { goto InvalidFormat; } parts |= Parts.HasYears; result._years = value; if (++pos == length) { goto Done; } errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } } if (s[pos] == 'M') { if (numDigits == 0) { goto InvalidFormat; } parts |= Parts.HasMonths; result._months = value; if (++pos == length) { goto Done; } errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } } if (s[pos] == 'D') { if (numDigits == 0) { goto InvalidFormat; } parts |= Parts.HasDays; result._days = value; if (++pos == length) { goto Done; } errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } } if (s[pos] == 'T') { if (numDigits != 0) { goto InvalidFormat; } pos++; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } if (s[pos] == 'H') { if (numDigits == 0) { goto InvalidFormat; } parts |= Parts.HasHours; result._hours = value; if (++pos == length) { goto Done; } errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } } if (s[pos] == 'M') { if (numDigits == 0) { goto InvalidFormat; } parts |= Parts.HasMinutes; result._minutes = value; if (++pos == length) { goto Done; } errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) { goto Error; } if (pos >= length) { goto InvalidFormat; } } if (s[pos] == '.') { pos++; parts |= Parts.HasSeconds; result._seconds = value; errorCode = TryParseDigits(s, ref pos, true, out value, out numDigits); if (errorCode != null) { goto Error; } if (numDigits == 0) { //If there are no digits after the decimal point, assume 0 value = 0; } // Normalize to nanosecond intervals for (; numDigits > 9; numDigits--) { value /= 10; } for (; numDigits < 9; numDigits++) { value *= 10; } result._nanoseconds |= (uint)value; if (pos >= length) { goto InvalidFormat; } if (s[pos] != 'S') { goto InvalidFormat; } if (++pos == length) { goto Done; } } else if (s[pos] == 'S') { if (numDigits == 0) { goto InvalidFormat; } parts |= Parts.HasSeconds; result._seconds = value; if (++pos == length) { goto Done; } } } // Duration cannot end with digits if (numDigits != 0) { goto InvalidFormat; } // No further characters are allowed if (pos != length) { goto InvalidFormat; } Done: // At least one part must be defined if (parts == Parts.HasNone) { goto InvalidFormat; } if (durationType == DurationType.DayTimeDuration) { if ((parts & (Parts.HasYears | Parts.HasMonths)) != 0) { goto InvalidFormat; } } else if (durationType == DurationType.YearMonthDuration) { if ((parts & ~(XsdDuration.Parts.HasYears | XsdDuration.Parts.HasMonths)) != 0) { goto InvalidFormat; } } return(null); InvalidFormat: return(new FormatException(SR.Format(SR.XmlConvert_BadFormat, s, durationType))); Error: return(new OverflowException(SR.Format(SR.XmlConvert_Overflow, s, durationType))); }
internal static Exception?TryParse(string s, out XsdDuration result) { return(TryParse(s, DurationType.Duration, out result)); }
/// <summary> /// Construct an XsdDuration from a TimeSpan value that represents an xsd:duration, an xdt:dayTimeDuration, or /// an xdt:yearMonthDuration. /// </summary> public XsdDuration(TimeSpan timeSpan, DurationType durationType) { long ticks = timeSpan.Ticks; ulong ticksPos; bool isNegative; if (ticks < 0) { // Note that (ulong) -Int64.MinValue = Int64.MaxValue + 1, which is what we want for that special case isNegative = true; ticksPos = (ulong) -ticks; } else { isNegative = false; ticksPos = (ulong) ticks; } if (durationType == DurationType.YearMonthDuration) { int years = (int) (ticksPos / ((ulong) TimeSpan.TicksPerDay * 365)); int months = (int) ((ticksPos % ((ulong) TimeSpan.TicksPerDay * 365)) / ((ulong) TimeSpan.TicksPerDay * 30)); if (months == 12) { // If remaining days >= 360 and < 365, then round off to year years++; months = 0; } this = new XsdDuration(isNegative, years, months, 0, 0, 0, 0, 0); } else { Debug.Assert(durationType == DurationType.Duration || durationType == DurationType.DayTimeDuration); // Tick count is expressed in 100 nanosecond intervals this.nanoseconds = (uint) (ticksPos % 10000000) * 100; if (isNegative) this.nanoseconds |= NegativeBit; this.years = 0; this.months = 0; this.days = (int) (ticksPos / (ulong) TimeSpan.TicksPerDay); this.hours = (int) ((ticksPos / (ulong) TimeSpan.TicksPerHour) % 24); this.minutes = (int) ((ticksPos / (ulong) TimeSpan.TicksPerMinute) % 60); this.seconds = (int) ((ticksPos / (ulong) TimeSpan.TicksPerSecond) % 60); } }
internal static Exception TryParse(string s, DurationType durationType, out XsdDuration result) { string errorCode; int length; int value, pos, numDigits; Parts parts = Parts.HasNone; result = new XsdDuration(); s = s.Trim(); length = s.Length; pos = 0; numDigits = 0; if (pos >= length) goto InvalidFormat; if (s[pos] == '-') { pos++; result.nanoseconds = NegativeBit; } else { result.nanoseconds = 0; } if (pos >= length) goto InvalidFormat; if (s[pos++] != 'P') goto InvalidFormat; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; if (s[pos] == 'Y') { if (numDigits == 0) goto InvalidFormat; parts |= Parts.HasYears; result.years = value; if (++pos == length) goto Done; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; } if (s[pos] == 'M') { if (numDigits == 0) goto InvalidFormat; parts |= Parts.HasMonths; result.months = value; if (++pos == length) goto Done; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; } if (s[pos] == 'D') { if (numDigits == 0) goto InvalidFormat; parts |= Parts.HasDays; result.days = value; if (++pos == length) goto Done; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; } if (s[pos] == 'T') { if (numDigits != 0) goto InvalidFormat; pos++; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; if (s[pos] == 'H') { if (numDigits == 0) goto InvalidFormat; parts |= Parts.HasHours; result.hours = value; if (++pos == length) goto Done; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; } if (s[pos] == 'M') { if (numDigits == 0) goto InvalidFormat; parts |= Parts.HasMinutes; result.minutes = value; if (++pos == length) goto Done; errorCode = TryParseDigits(s, ref pos, false, out value, out numDigits); if (errorCode != null) goto Error; if (pos >= length) goto InvalidFormat; } if (s[pos] == '.') { pos++; parts |= Parts.HasSeconds; result.seconds = value; errorCode = TryParseDigits(s, ref pos, true, out value, out numDigits); if (errorCode != null) goto Error; if (numDigits == 0) { //If there are no digits after the decimal point, assume 0 value = 0; } // Normalize to nanosecond intervals for (; numDigits > 9; numDigits--) value /= 10; for (; numDigits < 9; numDigits++) value *= 10; result.nanoseconds |= (uint) value; if (pos >= length) goto InvalidFormat; if (s[pos] != 'S') goto InvalidFormat; if (++pos == length) goto Done; } else if (s[pos] == 'S') { if (numDigits == 0) goto InvalidFormat; parts |= Parts.HasSeconds; result.seconds = value; if (++pos == length) goto Done; } } // Duration cannot end with digits if (numDigits != 0) goto InvalidFormat; // No further characters are allowed if (pos != length) goto InvalidFormat; Done: // At least one part must be defined if (parts == Parts.HasNone) goto InvalidFormat; if (durationType == DurationType.DayTimeDuration) { if ((parts & (Parts.HasYears | Parts.HasMonths)) != 0) goto InvalidFormat; } else if (durationType == DurationType.YearMonthDuration) { if ((parts & ~(XsdDuration.Parts.HasYears | XsdDuration.Parts.HasMonths)) != 0) goto InvalidFormat; } return null; InvalidFormat: return new FormatException(Res.GetString(Res.XmlConvert_BadFormat, s, durationType)); Error: return new OverflowException(Res.GetString(Res.XmlConvert_Overflow, s, durationType)); }
protected static TimeSpan StringToYearMonthDuration(string value) { XsdDuration duration = new XsdDuration(value, XsdDuration.DurationType.YearMonthDuration); return(duration.ToTimeSpan(XsdDuration.DurationType.YearMonthDuration)); }
protected static string DurationToString(TimeSpan value) { XsdDuration duration = new XsdDuration(value, XsdDuration.DurationType.Duration); return(duration.ToString(XsdDuration.DurationType.Duration)); }
public XsdDuration(TimeSpan timeSpan, DurationType durationType) { ulong num2; bool flag; long ticks = timeSpan.Ticks; if (ticks < 0L) { flag = true; num2 = (ulong) -ticks; } else { flag = false; num2 = (ulong) ticks; } if (durationType == DurationType.YearMonthDuration) { int years = (int) (num2 / ((ulong) 0x11ed178c6c000L)); int months = (int) ((num2 % ((ulong) 0x11ed178c6c000L)) / ((ulong) 0x1792f8648000L)); if (months == 12) { years++; months = 0; } this = new XsdDuration(flag, years, months, 0, 0, 0, 0, 0); } else { this.nanoseconds = ((uint) (num2 % ((ulong) 0x989680L))) * 100; if (flag) { this.nanoseconds |= 0x80000000; } this.years = 0; this.months = 0; this.days = (int) (num2 / ((ulong) 0xc92a69c000L)); this.hours = (int) ((num2 / ((ulong) 0x861c46800L)) % ((ulong) 0x18L)); this.minutes = (int) ((num2 / ((ulong) 0x23c34600L)) % ((ulong) 60L)); this.seconds = (int) ((num2 / ((ulong) 0x989680L)) % ((ulong) 60L)); } }
internal static Exception TryParse(string s, DurationType durationType, out XsdDuration result) { int num2; Parts hasNone = Parts.HasNone; result = new XsdDuration(); s = s.Trim(); int length = s.Length; int offset = 0; int numDigits = 0; if (offset >= length) { goto Label_02D8; } if (s[offset] == '-') { offset++; result.nanoseconds = 0x80000000; } else { result.nanoseconds = 0; } if ((offset >= length) || (s[offset++] != 'P')) { goto Label_02D8; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } if (s[offset] == 'Y') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasYears; result.years = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'M') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasMonths; result.months = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'D') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasDays; result.days = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'T') { if (numDigits != 0) { goto Label_02D8; } offset++; if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } if (s[offset] == 'H') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasHours; result.hours = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'M') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasMinutes; result.minutes = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == '.') { offset++; hasNone |= Parts.HasSeconds; result.seconds = num2; if (TryParseDigits(s, ref offset, true, out num2, out numDigits) != null) { goto Label_0301; } if (numDigits == 0) { num2 = 0; } while (numDigits > 9) { num2 /= 10; numDigits--; } while (numDigits < 9) { num2 *= 10; numDigits++; } result.nanoseconds |= (uint) num2; if ((offset >= length) || (s[offset] != 'S')) { goto Label_02D8; } if (++offset != length) { goto Label_02B3; } goto Label_02BB; } if (s[offset] == 'S') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasSeconds; result.seconds = num2; if (++offset == length) { goto Label_02BB; } } } Label_02B3: if ((numDigits != 0) || (offset != length)) { goto Label_02D8; } Label_02BB: if (hasNone == Parts.HasNone) { goto Label_02D8; } if (durationType == DurationType.DayTimeDuration) { if ((hasNone & (Parts.HasMonths | Parts.HasYears)) == Parts.HasNone) { goto Label_02D6; } goto Label_02D8; } if ((durationType == DurationType.YearMonthDuration) && ((hasNone & ~(Parts.HasMonths | Parts.HasYears)) != Parts.HasNone)) { goto Label_02D8; } Label_02D6: return null; Label_02D8:; return new FormatException(Res.GetString("XmlConvert_BadFormat", new object[] { s, durationType })); Label_0301:; return new OverflowException(Res.GetString("XmlConvert_Overflow", new object[] { s, durationType })); }
protected static TimeSpan StringToYearMonthDuration(string value) { XsdDuration duration = new XsdDuration(value, XsdDuration.DurationType.YearMonthDuration); return duration.ToTimeSpan(XsdDuration.DurationType.YearMonthDuration); }
protected static string DurationToString(TimeSpan value) { XsdDuration duration = new XsdDuration(value, XsdDuration.DurationType.Duration); return duration.ToString(XsdDuration.DurationType.Duration); }
public static string ToString(TimeSpan value) { XsdDuration duration = new XsdDuration(value); return duration.ToString(); }
internal static Exception TryParse(string s, out XsdDuration result) { return TryParse(s, DurationType.Duration, out result); }
public static TimeSpan ToTimeSpan(string s) { XsdDuration duration; try { duration = new XsdDuration(s); } catch (Exception) { throw new FormatException(Res.GetString("XmlConvert_BadFormat", new object[] { s, "TimeSpan" })); } return duration.ToTimeSpan(); }
internal static Exception TryParse(string s, DurationType durationType, out XsdDuration result) { int num2; Parts hasNone = Parts.HasNone; result = new XsdDuration(); s = s.Trim(); int length = s.Length; int offset = 0; int numDigits = 0; if (offset >= length) { goto Label_02D8; } if (s[offset] == '-') { offset++; result.nanoseconds = 0x80000000; } else { result.nanoseconds = 0; } if ((offset >= length) || (s[offset++] != 'P')) { goto Label_02D8; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } if (s[offset] == 'Y') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasYears; result.years = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'M') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasMonths; result.months = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'D') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasDays; result.days = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'T') { if (numDigits != 0) { goto Label_02D8; } offset++; if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } if (s[offset] == 'H') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasHours; result.hours = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == 'M') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasMinutes; result.minutes = num2; if (++offset == length) { goto Label_02BB; } if (TryParseDigits(s, ref offset, false, out num2, out numDigits) != null) { goto Label_0301; } if (offset >= length) { goto Label_02D8; } } if (s[offset] == '.') { offset++; hasNone |= Parts.HasSeconds; result.seconds = num2; if (TryParseDigits(s, ref offset, true, out num2, out numDigits) != null) { goto Label_0301; } if (numDigits == 0) { num2 = 0; } while (numDigits > 9) { num2 /= 10; numDigits--; } while (numDigits < 9) { num2 *= 10; numDigits++; } result.nanoseconds |= (uint)num2; if ((offset >= length) || (s[offset] != 'S')) { goto Label_02D8; } if (++offset != length) { goto Label_02B3; } goto Label_02BB; } if (s[offset] == 'S') { if (numDigits == 0) { goto Label_02D8; } hasNone |= Parts.HasSeconds; result.seconds = num2; if (++offset == length) { goto Label_02BB; } } } Label_02B3: if ((numDigits != 0) || (offset != length)) { goto Label_02D8; } Label_02BB: if (hasNone == Parts.HasNone) { goto Label_02D8; } if (durationType == DurationType.DayTimeDuration) { if ((hasNone & (Parts.HasMonths | Parts.HasYears)) == Parts.HasNone) { goto Label_02D6; } goto Label_02D8; } if ((durationType == DurationType.YearMonthDuration) && ((hasNone & ~(Parts.HasMonths | Parts.HasYears)) != Parts.HasNone)) { goto Label_02D8; } Label_02D6: return(null); Label_02D8 :; return(new FormatException(Res.GetString("XmlConvert_BadFormat", new object[] { s, durationType }))); Label_0301 :; return(new OverflowException(Res.GetString("XmlConvert_Overflow", new object[] { s, durationType }))); }