~sircmpwn/ChatSharp

f65386343671fff10990ccba02b6ef086136b3b8 — Alexandre Oliveira 4 years ago 89ba7e2
Use TryParse instead of TryParseExact

- Using TryParseExact would crash if the server
  sent us a time string with 2-digit milliseconds.
1 files changed, 1 insertions(+), 1 deletions(-)

M ChatSharp/Timestamp.cs
M ChatSharp/Timestamp.cs => ChatSharp/Timestamp.cs +1 -1
@@ 28,7 28,7 @@ namespace ChatSharp
            if (!compatibility)
            {
                DateTime parsedDate;
                if (!DateTime.TryParseExact(date, @"yyyy-MM-dd\THH:mm:ss.fff\Z", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out parsedDate))
                if (!DateTime.TryParse(date, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out parsedDate))
                    throw new ArgumentException("The date string was provided in an invalid format.", date);

                Date = parsedDate;