private static string[] ReadAnsiStringArray(BinaryReader reader) { ushort num = reader.ReadUInt16(); string[] array = new string[(int)num]; for (int i = 0; i < (int)num; i++) { array[i] = BlobRecipientParser.ReadAnsiString(reader); } return(array); }
internal static void WriteRecipients(Stream stream, List <BlobRecipient> list) { uint value = 1U; uint value2 = (uint)((ushort)list.Count); BinaryWriter binaryWriter = new BinaryWriter(stream); binaryWriter.Write(value); binaryWriter.Write(value2); foreach (BlobRecipient recipient in list) { BlobRecipientParser.WriteRecipient(binaryWriter, recipient); } stream.Flush(); }
internal static List <BlobRecipient> ReadRecipients(Item item, PropertyDefinition propertyDefinition) { item.Load(new PropertyDefinition[] { propertyDefinition }); try { Stream stream = null; object obj = item.TryGetProperty(propertyDefinition); try { if (obj is byte[]) { stream = new MemoryStream(obj as byte[], false); } else if (PropertyError.IsPropertyValueTooBig(obj)) { stream = item.OpenPropertyStream(propertyDefinition, PropertyOpenMode.ReadOnly); } if (stream != null) { return(BlobRecipientParser.ReadRecipients(item.PropertyBag.ExTimeZone, stream)); } } finally { if (stream != null) { stream.Dispose(); } } } catch (PropertyErrorException) { } return(new List <BlobRecipient>()); }
private static void WriteRecipient(BinaryWriter writer, BlobRecipient recipient) { List <PropValue> list = new List <PropValue>(recipient.PropertyValues.Count); foreach (PropValue item in PropValue.ConvertEnumerator <PropertyDefinition>(recipient.PropertyValues)) { if (!PropertyError.IsPropertyError(item.Value) && !((PropTag)((PropertyTagPropertyDefinition)item.Property).PropertyTag).IsNamedProperty()) { list.Add(item); } } uint count = (uint)list.Count; uint value = 0U; writer.Write(count); writer.Write(value); foreach (PropValue propValue in list) { PropertyTagPropertyDefinition propertyTagPropertyDefinition = (PropertyTagPropertyDefinition)propValue.Property; object value2 = ExTimeZoneHelperForMigrationOnly.ToUtcIfDateTime(propValue.Value); BlobRecipientParser.WritePropValue(writer, (PropTag)propertyTagPropertyDefinition.PropertyTag, value2); } }
protected override void UpdateCalendarItemInternal(ref CalendarItemBase originalCalendarItem) { if (!this.IsMfnProcessed) { List <BlobRecipient> forwardedAttendees = this.GetForwardedAttendees(); IAttendeeCollection attendeeCollection = originalCalendarItem.AttendeeCollection; Participant organizer = originalCalendarItem.Organizer; List <BlobRecipient> list = new List <BlobRecipient>(); foreach (BlobRecipient blobRecipient in forwardedAttendees) { bool flag = this.AddAttendee(attendeeCollection, organizer, blobRecipient, originalCalendarItem.LocationIdentifierHelperInstance); if (flag) { list.Add(blobRecipient); } } if (list.Count > 0) { BlobRecipientParser.WriteRecipients(this, InternalSchema.MFNAddedRecipients, list); } this.SetCalendarProcessingSteps(CalendarProcessingSteps.ProcessedMeetingForwardNotification); } }
internal List <BlobRecipient> GetUnsendableRecipients() { List <BlobRecipient> blobRecipientList = BlobRecipientParser.ReadRecipients(this, InternalSchema.UnsendableRecipients); return(MeetingRequest.FilterBlobRecipientList(blobRecipientList)); }
private static void WritePropValue(BinaryWriter writer, PropTag ptag, object value) { PropType propType = ptag.ValueType(); writer.Write((uint)ptag); PropType propType2 = propType; if (propType2 <= PropType.String) { if (propType2 <= PropType.Boolean) { switch (propType2) { case PropType.Short: writer.Write((short)value); return; case PropType.Int: break; default: switch (propType2) { case PropType.Error: break; case PropType.Boolean: { ushort value2 = ((bool)value) ? 1 : 0; writer.Write(value2); return; } default: goto IL_13A; } break; } } else if (propType2 != PropType.Long) { switch (propType2) { case PropType.AnsiString: BlobRecipientParser.WriteAnsiString(writer, (string)value); return; case PropType.String: BlobRecipientParser.WriteString(writer, (string)value); return; default: goto IL_13A; } } writer.Write((int)value); return; } if (propType2 <= PropType.Binary) { if (propType2 != PropType.SysTime) { if (propType2 != PropType.Binary) { goto IL_13A; } BlobRecipientParser.WriteBinary(writer, (byte[])value); return; } else { try { BlobRecipientParser.WriteDateTime(writer, (ExDateTime)value); return; } catch (ArgumentException) { ExTraceGlobals.StorageTracer.TraceError <PropTag>(0L, "BlobRecipientParser::WritePropValue. Skipping bad SysTime property ptag = {0}.", ptag); return; } } } else { switch (propType2) { case PropType.AnsiStringArray: break; case PropType.StringArray: BlobRecipientParser.WriteStringArray(writer, (string[])value); return; default: if (propType2 != PropType.BinaryArray) { goto IL_13A; } BlobRecipientParser.WriteBinaryArray(writer, (byte[][])value); return; } } BlobRecipientParser.WriteAnsiStringArray(writer, (string[])value); return; IL_13A: ExTraceGlobals.StorageTracer.TraceError <PropType>(0L, "BlobRecipientParser::WritePropValue. Skipping susupported propType={0}.", propType); }
private static bool ReadPropValue(BinaryReader reader, out PropTag ptag, out object value) { ptag = (PropTag)reader.ReadUInt32(); value = null; PropType propType = ptag.ValueType(); PropType propType2 = propType; if (propType2 <= PropType.String) { if (propType2 <= PropType.Boolean) { switch (propType2) { case PropType.Null: case PropType.Int: break; case PropType.Short: value = reader.ReadUInt16(); goto IL_135; default: switch (propType2) { case PropType.Error: break; case PropType.Boolean: value = (reader.ReadUInt16() != 0); goto IL_135; default: goto IL_123; } break; } } else if (propType2 != PropType.Long) { switch (propType2) { case PropType.AnsiString: value = BlobRecipientParser.ReadAnsiString(reader); goto IL_135; case PropType.String: value = BlobRecipientParser.ReadString(reader); goto IL_135; default: goto IL_123; } } value = reader.ReadInt32(); goto IL_135; } if (propType2 <= PropType.Binary) { if (propType2 == PropType.SysTime) { value = BlobRecipientParser.ReadDateTime(reader); goto IL_135; } if (propType2 == PropType.Binary) { value = BlobRecipientParser.ReadBinary(reader); goto IL_135; } } else { switch (propType2) { case PropType.AnsiStringArray: value = BlobRecipientParser.ReadAnsiStringArray(reader); goto IL_135; case PropType.StringArray: value = BlobRecipientParser.ReadStringArray(reader); goto IL_135; default: if (propType2 == PropType.BinaryArray) { value = BlobRecipientParser.ReadBinaryArray(reader); goto IL_135; } break; } } IL_123: ExTraceGlobals.StorageTracer.TraceError <PropType>(0L, "BlobRecipientParser::ReadPropValue. Not supported PropType= {0}.", propType); IL_135: return(value != null); }
public static MessageItem CreateForward(MessageItem originalItem, bool asAttachment, CultureInfo culture, string imceaDomain, string xLoop, ExTimeZone timeZone, IRuleEvaluationContext context) { Util.ThrowOnNullArgument(originalItem, "originalItem"); Util.ThrowOnNullArgument(culture, "culture"); Util.ThrowOnNullOrEmptyArgument(imceaDomain, "imceaDomain"); ExTraceGlobals.StorageTracer.Information(0L, "RuleMessageUtils::CreateForward."); MessageItem messageItem = null; bool flag = false; MessageItem result; try { ForwardCreationFlags forwardCreationFlags = ForwardCreationFlags.None; string className = originalItem.ClassName; if (ObjectClass.IsMeetingMessage(className)) { forwardCreationFlags |= ForwardCreationFlags.TreatAsMeetingMessage; } messageItem = context.CreateMessageItem(InternalSchema.ContentConversionProperties); messageItem[InternalSchema.ItemClass] = "IPM.Note"; StoreSession storeSession = context.StoreSession ?? originalItem.Session; if (asAttachment) { ForwardAsAttachmentCreation forwardAsAttachmentCreation = new ForwardAsAttachmentCreation(originalItem, messageItem, new ReplyForwardConfiguration(forwardCreationFlags, culture) { XLoop = xLoop, TimeZone = timeZone, ConversionOptionsForSmime = new InboundConversionOptions(storeSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), imceaDomain) }); forwardAsAttachmentCreation.PopulateProperties(); } else { bool flag2 = ObjectClass.IsMeetingCancellation(className); bool flag3 = ObjectClass.IsMeetingRequest(className); bool isRestricted = originalItem.IsRestricted; if (flag2) { messageItem[InternalSchema.ItemClass] = "IPM.Schedule.Meeting.Canceled"; messageItem[InternalSchema.IconIndex] = IconIndex.AppointmentMeetCancel; } else if (flag3) { messageItem[InternalSchema.ItemClass] = "IPM.Schedule.Meeting.Request"; messageItem[InternalSchema.IsResponseRequested] = true; messageItem[InternalSchema.IsReplyRequested] = true; } else if (isRestricted) { messageItem[StoreObjectSchema.ContentClass] = "rpmsg.message"; messageItem.IconIndex = IconIndex.MailIrm; } BodyFormat format = originalItem.Body.Format; ReplyForwardConfiguration replyForwardConfiguration = new ReplyForwardConfiguration(format, forwardCreationFlags, culture); replyForwardConfiguration.XLoop = xLoop; replyForwardConfiguration.TimeZone = timeZone; replyForwardConfiguration.ConversionOptionsForSmime = new InboundConversionOptions(storeSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), imceaDomain); RuleMessageUtils.GenerateHeader(replyForwardConfiguration, originalItem); ForwardCreation forwardCreation = new ForwardCreation(originalItem, messageItem, replyForwardConfiguration); forwardCreation.PopulateProperties(); if (flag2 || flag3) { AppointmentStateFlags appointmentStateFlags = messageItem.GetValueOrDefault <AppointmentStateFlags>(InternalSchema.AppointmentState); appointmentStateFlags |= (AppointmentStateFlags.Meeting | AppointmentStateFlags.Received); messageItem[InternalSchema.AppointmentState] = appointmentStateFlags; int num = messageItem.GetValueOrDefault <int>(InternalSchema.AppointmentAuxiliaryFlags, 0); num |= 4; messageItem[InternalSchema.AppointmentAuxiliaryFlags] = num; if (flag3) { List <BlobRecipient> list = BlobRecipientParser.ReadRecipients(originalItem, InternalSchema.UnsendableRecipients); list = MeetingRequest.FilterBlobRecipientList(list); list = MeetingRequest.MergeRecipientLists(originalItem.Recipients, list); list = MeetingRequest.FilterBlobRecipientList(list); BlobRecipientParser.WriteRecipients(messageItem, InternalSchema.UnsendableRecipients, list); } } } flag = true; result = messageItem; } finally { if (!flag && messageItem != null) { messageItem.Dispose(); messageItem = null; } } return(result); }
internal void SetForwardedAttendees(List <BlobRecipient> list) { base.LocationIdentifierHelperInstance.SetLocationIdentifier(60277U, LastChangeAction.SetForwardedAttendees); BlobRecipientParser.WriteRecipients(this, InternalSchema.ForwardNotificationRecipients, list); }
internal List <BlobRecipient> GetMFNAddedAttendees() { return(BlobRecipientParser.ReadRecipients(this, InternalSchema.MFNAddedRecipients)); }
internal List <BlobRecipient> GetForwardedAttendees() { return(BlobRecipientParser.ReadRecipients(this, InternalSchema.ForwardNotificationRecipients)); }