private RetryConditionHeaderValue(RetryConditionHeaderValue source) { this.delta = source.delta; this.date = source.date; }
/// <summary>Determines whether a string is valid <see cref="T:NMasters.Silverlight.Net.Http.Headers.RetryConditionHeaderValue" /> information.</summary> /// <returns>Returns <see cref="T:System.Boolean" />.true if <paramref name="input" /> is valid <see cref="T:NMasters.Silverlight.Net.Http.Headers.RetryConditionHeaderValue" /> information; otherwise, false.</returns> /// <param name="input">The string to validate.</param> /// <param name="parsedValue">The <see cref="T:NMasters.Silverlight.Net.Http.Headers.RetryConditionHeaderValue" /> version of the string.</param> public static bool TryParse(string input, out RetryConditionHeaderValue parsedValue) { object obj2; int index = 0; parsedValue = null; if (GenericHeaderParser.RetryConditionParser.TryParseValue(input, null, ref index, out obj2)) { parsedValue = (RetryConditionHeaderValue) obj2; return true; } return false; }
internal static int GetRetryConditionLength(string input, int startIndex, out object parsedValue) { parsedValue = null; if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) { return 0; } int num = startIndex; DateTimeOffset minValue = DateTimeOffset.MinValue; int result = -1; char ch = input[num]; if ((ch >= '0') && (ch <= '9')) { int num3 = num; int length = HttpRuleParser.GetNumberLength(input, num, false); if ((length == 0) || (length > 10)) { return 0; } num += length; num += HttpRuleParser.GetWhitespaceLength(input, num); if ((num != input.Length) || !HeaderUtilities.TryParseInt32(input.Substring(num3, length), out result)) { return 0; } } else { if (!HttpRuleParser.TryStringToDate(input.Substring(num), out minValue)) { return 0; } num = input.Length; } RetryConditionHeaderValue value2 = new RetryConditionHeaderValue(); if (result == -1) { value2.date = new DateTimeOffset?(minValue); } else { value2.delta = new TimeSpan(0, 0, result); } parsedValue = value2; return (num - startIndex); }