public Forward ( int charCount ) : bool | ||
charCount | int | The successfully matched character count. /// Must be positive and should not move head past the end of the substring. |
return | bool |
/// <summary> /// Matches a DateTime in the <see cref="FileNameUniqueTimeUtcFormat"/> format. /// </summary> /// <param name="this">This <see cref="StringMatcher"/>.</param> /// <param name="time">Result time on success; otherwise <see cref="Util.UtcMinValue"/>.</param> /// <returns>True if the time has been matched.</returns> public static bool MatchFileNameUniqueTimeUtcFormat(this StringMatcher @this, out DateTime time) { time = Util.UtcMinValue; Debug.Assert(FileNameUniqueTimeUtcFormat.Replace("\\", "").Length == 27); return(@this.Length >= 27 && DateTime.TryParseExact(@this.Text.Substring(@this.StartIndex, 27), FileUtil.FileNameUniqueTimeUtcFormat, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out time) ? @this.Forward(27) : @this.SetError()); }
/// <summary> /// Matches a <see cref="DateTimeStamp"/>. /// </summary> /// <param name="this">This <see cref="StringMatcher"/>.</param> /// <param name="time">Resulting time stamp on successful match; <see cref="DateTimeStamp.Unknown"/> otherwise.</param> /// <returns>True if the time stamp has been matched.</returns> static public bool MatchDateTimeStamp(this StringMatcher @this, out DateTimeStamp time) { time = DateTimeStamp.Unknown; int savedIndex = @this.StartIndex; DateTime t; if ([email protected](out t)) { return(@this.SetError()); } byte uniquifier = 0; if (@this.MatchChar('(')) { int unique; if ([email protected](out unique, 0, 255) || [email protected](')')) { return(@this.BackwardAddError(savedIndex)); } uniquifier = (byte)unique; } time = new DateTimeStamp(t, uniquifier); return(@this.Forward(0)); }