public CalendarEvent(ForwardedEmail email) { Match match = SujectLineParser.Parse(email.Subject); switch (match.Groups[2].Value) { case Constants.Rescheduled: case Constants.Invitation: People = match.Groups[5].Value.Trim(); if (string.IsNullOrEmpty(match.Groups[6].Value)) { throw new NoDateFoundException(); } EventDate = Parse(match.Groups[6].Value.Trim(), match.Groups[8].Value.Trim()); MiscInformation = match.Groups[9].Value.Trim(); break; case Constants.Cancelled: { break; } default: throw new NotImplementedException(); } From = match.Groups[1].Value.Trim(); Title = match.Groups[3].Value.Trim(); RelatedEmails.Add(email); }
private void SetOperationAndTitle(string subject) { try { Match match = SujectLineParser.Parse(subject); Operation = match.Groups[2].Value.Trim(); Title = match.Groups[3].Value.Trim(); Status = Constants.Parsed; } catch (ParsingFailedException) { Status = Constants.Error; } }