private void Write6_Item(string n, string ns, CalendarNotificationContentVersion1Point0 o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } return; } if (!needType) { Type type = o.GetType(); if (!(type == typeof(CalendarNotificationContentVersion1Point0))) { throw base.CreateUnknownTypeException(o); } } base.WriteStartElement(n, ns, o, false, null); if (needType) { base.WriteXsiType("CalendarNotificationContentVersion1Point0", ""); } base.WriteAttribute("Version", "", o.Version); base.WriteElementString("CalNotifType", "", this.Write4_CalendarNotificationType(o.CalNotifType)); base.WriteElementString("CalNotifTypeDesc", "", o.CalNotifTypeDesc); List <CalendarEvent> calEvents = o.CalEvents; if (calEvents != null) { for (int i = 0; i < ((ICollection)calEvents).Count; i++) { this.Write5_CalendarEvent("CalEvent", "", calEvents[i], false, false); } } base.WriteEndElement(o); }
private CalendarNotificationContentVersion1Point0 Read6_Item(bool isNullable, bool checkType) { XmlQualifiedName xmlQualifiedName = checkType ? base.GetXsiType() : null; bool flag = false; if (isNullable) { flag = base.ReadNull(); } if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != this.id3_Item || xmlQualifiedName.Namespace != this.id2_Item)) { throw base.CreateUnknownTypeException(xmlQualifiedName); } if (flag) { return(null); } CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point = new CalendarNotificationContentVersion1Point0(); if (calendarNotificationContentVersion1Point.CalEvents == null) { calendarNotificationContentVersion1Point.CalEvents = new List <CalendarEvent>(); } List <CalendarEvent> calEvents = calendarNotificationContentVersion1Point.CalEvents; bool[] array = new bool[4]; while (base.Reader.MoveToNextAttribute()) { if (!array[0] && base.Reader.LocalName == this.id4_Version && base.Reader.NamespaceURI == this.id2_Item) { calendarNotificationContentVersion1Point.Version = base.Reader.Value; array[0] = true; } else if (!base.IsXmlnsAttribute(base.Reader.Name)) { base.UnknownNode(calendarNotificationContentVersion1Point, ":Version"); } } base.Reader.MoveToElement(); if (base.Reader.IsEmptyElement) { base.Reader.Skip(); return(calendarNotificationContentVersion1Point); } base.Reader.ReadStartElement(); base.Reader.MoveToContent(); int num = 0; int readerCount = base.ReaderCount; while (base.Reader.NodeType != XmlNodeType.EndElement && base.Reader.NodeType != XmlNodeType.None) { if (base.Reader.NodeType == XmlNodeType.Element) { if (!array[1] && base.Reader.LocalName == this.id5_CalNotifType && base.Reader.NamespaceURI == this.id2_Item) { calendarNotificationContentVersion1Point.CalNotifType = this.Read4_CalendarNotificationType(base.Reader.ReadElementString()); array[1] = true; } else if (!array[2] && base.Reader.LocalName == this.id6_CalNotifTypeDesc && base.Reader.NamespaceURI == this.id2_Item) { calendarNotificationContentVersion1Point.CalNotifTypeDesc = base.Reader.ReadElementString(); array[2] = true; } else if (base.Reader.LocalName == this.id7_CalEvent && base.Reader.NamespaceURI == this.id2_Item) { if (calEvents == null) { base.Reader.Skip(); } else { calEvents.Add(this.Read5_CalendarEvent(false, true)); } } else { base.UnknownNode(calendarNotificationContentVersion1Point, ":CalNotifType, :CalNotifTypeDesc, :CalEvent"); } } else { base.UnknownNode(calendarNotificationContentVersion1Point, ":CalNotifType, :CalNotifTypeDesc, :CalEvent"); } base.Reader.MoveToContent(); base.CheckReaderCount(ref num, ref readerCount); } base.ReadEndElement(); return(calendarNotificationContentVersion1Point); }
// Token: 0x06000A2B RID: 2603 RVA: 0x00042F58 File Offset: 0x00041158 public void Emit(MailboxSession session, CalendarNotificationType type, IList <CalendarInfo> events) { ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Text Emitter is invoked, subject: {0} for user {1}", events[0].NormalizedSubject, this.MailboxData.Settings.LegacyDN); if (type == CalendarNotificationType.Uninteresting) { return; } Emitter emitter = null; foreach (Emitter emitter2 in this.MailboxData.Settings.Text.TextNotification.CalendarNotificationSettings.Emitters) { if (EmitterType.TextMessaging == emitter2.Type) { emitter = emitter2; break; } } if (emitter == null || emitter.PhoneNumbers.Count == 0) { return; } MailboxRegionalConfiguration regionalConfiguration = this.MailboxData.Settings.Text.RegionalConfiguration; CultureInfo cultureInfo = regionalConfiguration.Language ?? CultureInfo.InvariantCulture; string text = regionalConfiguration.TimeFormat; if (string.IsNullOrEmpty(text)) { text = cultureInfo.DateTimeFormat.ShortTimePattern; } string text2 = regionalConfiguration.DateFormat; if (string.IsNullOrEmpty(text2)) { text2 = cultureInfo.DateTimeFormat.ShortDatePattern; } bool flag = false; try { if (session == null) { ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLocalServerMailboxGuid(this.MailboxData.Settings.GetADSettings(), this.MailboxData.DatabaseGuid, this.MailboxData.MailboxGuid); session = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=Emit"); flag = true; } ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "Text Emitter is emitting for user {0}", this.MailboxData.Settings.LegacyDN); if (CalendarNotificationType.Summary == type) { CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point = new CalendarNotificationContentVersion1Point0(); calendarNotificationContentVersion1Point.CalNotifType = type; calendarNotificationContentVersion1Point.CalNotifTypeDesc = Strings.notifTypeSummary.ToString(cultureInfo); string agendaDateFormat = TextNotificationFactory.TextMessagingEmitter.GetAgendaDateFormat(text2); string timeOfStartTime = string.Empty; foreach (CalendarInfo calendarInfo in events) { timeOfStartTime = calendarInfo.StartTime.ToString("H:mm", cultureInfo); if (calendarInfo.EndTime.Subtract(calendarInfo.StartTime).Equals(TimeSpan.FromDays(1.0)) && calendarInfo.StartTime.Hour == 0 && calendarInfo.StartTime.Minute == 0) { timeOfStartTime = string.Empty; } calendarNotificationContentVersion1Point.CalEvents.Add(new CalendarEvent(cultureInfo.DateTimeFormat.GetDayName(calendarInfo.StartTime.DayOfWeek), calendarInfo.StartTime.ToString(agendaDateFormat, cultureInfo), timeOfStartTime, cultureInfo.DateTimeFormat.GetDayName(calendarInfo.EndTime.DayOfWeek), calendarInfo.EndTime.ToString(agendaDateFormat, cultureInfo), calendarInfo.EndTime.ToString("H:mm", cultureInfo), calendarInfo.NormalizedSubject ?? string.Empty, calendarInfo.Location ?? string.Empty)); } TextNotificationFactory.TextMessagingEmitter.SendTextMessage(session, emitter.PhoneNumbers, calendarNotificationContentVersion1Point.ToString(), CalNotifsCounters.NumberOfAgendasSent); } else { foreach (CalendarInfo calendarInfo2 in events) { CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point2 = new CalendarNotificationContentVersion1Point0(); calendarNotificationContentVersion1Point2.CalNotifType = type; bool flag2 = false; ExPerformanceCounter perfcounter; switch (type) { case CalendarNotificationType.Reminder: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeReminder.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfTextRemindersSent; break; case CalendarNotificationType.NewUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeNewUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; case CalendarNotificationType.ChangedUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeChangedUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; case CalendarNotificationType.DeletedUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeDeletedUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; default: throw new InvalidOperationException("unsupported CalendarNotificationType"); } if (flag2) { CalendarChangeProcessor.UpdateAverageProcessingLatency(calendarInfo2.CreationRequestTime); } calendarNotificationContentVersion1Point2.CalEvents.Add(new CalendarEvent(cultureInfo.DateTimeFormat.GetDayName(calendarInfo2.StartTime.DayOfWeek), calendarInfo2.StartTime.ToString(text2, cultureInfo), calendarInfo2.StartTime.ToString(text, cultureInfo), cultureInfo.DateTimeFormat.GetDayName(calendarInfo2.EndTime.DayOfWeek), calendarInfo2.EndTime.ToString(text2, cultureInfo), calendarInfo2.EndTime.ToString(text, cultureInfo), calendarInfo2.NormalizedSubject ?? string.Empty, calendarInfo2.Location ?? string.Empty)); TextNotificationFactory.TextMessagingEmitter.SendTextMessage(session, emitter.PhoneNumbers, calendarNotificationContentVersion1Point2.ToString(), perfcounter); } } ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Text Emitter is emitted, subject: {0}, user: {1}", events[0].NormalizedSubject, this.MailboxData.Settings.LegacyDN); } finally { if (flag) { session.Dispose(); session = null; } } }