Exemplo n.º 1
0
 internal static MessageIdentity Create(Version sourceVersion, KeyValuePair <string, object> pair, PropertyStreamReader reader)
 {
     if (!(sourceVersion <= MessageIdentity.messageIdAsTextVersion))
     {
         return(MessageIdentity.Create(reader));
     }
     return(MessageIdentity.Parse(PropertyStreamReader.GetValue <string>(pair)));
 }
Exemplo n.º 2
0
        private PropertyBagBasedMessageInfo(PropertyStreamReader reader, Version sourceVersion) : base(new MessageInfoPropertyBag())
        {
            KeyValuePair <string, object> keyValuePair;

            reader.Read(out keyValuePair);
            if (!string.Equals("NumProperties", keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
            {
                throw new SerializationException(string.Format("Cannot deserialize PropertyBagBasedMessageInfo. Expected property NumProperties, but found property '{0}'", keyValuePair.Key));
            }
            int value = PropertyStreamReader.GetValue <int>(keyValuePair);

            for (int i = 0; i < value; i++)
            {
                reader.Read(out keyValuePair);
                if (string.Equals(ExtensibleMessageInfoSchema.Identity.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    MessageIdentity value2 = MessageIdentity.Create(sourceVersion, keyValuePair, reader);
                    this.propertyBag[ExtensibleMessageInfoSchema.Identity] = value2;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.Status.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    MessageStatus value3 = (MessageStatus)PropertyStreamReader.GetValue <int>(keyValuePair);
                    this.propertyBag[ExtensibleMessageInfoSchema.Status] = value3;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.Size.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    ByteQuantifiedSize byteQuantifiedSize = new ByteQuantifiedSize(PropertyStreamReader.GetValue <ulong>(keyValuePair));
                    this.propertyBag[ExtensibleMessageInfoSchema.Size] = byteQuantifiedSize;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.MessageLatency.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    EnhancedTimeSpan enhancedTimeSpan = EnhancedTimeSpan.Parse(PropertyStreamReader.GetValue <string>(keyValuePair));
                    this.propertyBag[ExtensibleMessageInfoSchema.MessageLatency] = enhancedTimeSpan;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    Guid value4 = PropertyStreamReader.GetValue <Guid>(keyValuePair);
                    this.propertyBag[ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId] = value4;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.Directionality.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    MailDirectionality value5 = (MailDirectionality)PropertyStreamReader.GetValue <int>(keyValuePair);
                    this.propertyBag[ExtensibleMessageInfoSchema.Directionality] = value5;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.Recipients.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    int             value6 = PropertyStreamReader.GetValue <int>(keyValuePair);
                    RecipientInfo[] array  = new RecipientInfo[value6];
                    for (int j = 0; j < value6; j++)
                    {
                        RecipientInfo recipientInfo = RecipientInfo.Create(reader);
                        array[j] = recipientInfo;
                    }
                    this.propertyBag[ExtensibleMessageInfoSchema.Recipients] = array;
                }
                else if (string.Equals(ExtensibleMessageInfoSchema.ComponentLatency.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    int value7 = PropertyStreamReader.GetValue <int>(keyValuePair);
                    ComponentLatencyInfo[] array2 = new ComponentLatencyInfo[value7];
                    for (int k = 0; k < value7; k++)
                    {
                        ComponentLatencyInfo componentLatencyInfo = ComponentLatencyInfo.Create(reader);
                        array2[k] = componentLatencyInfo;
                    }
                    this.propertyBag[ExtensibleMessageInfoSchema.ComponentLatency] = array2;
                }
                else
                {
                    PropertyDefinition fieldByName = PropertyBagBasedMessageInfo.schema.GetFieldByName(keyValuePair.Key);
                    if (fieldByName != null)
                    {
                        this.propertyBag.SetField((QueueViewerPropertyDefinition <ExtensibleMessageInfo>)fieldByName, keyValuePair.Value);
                    }
                    else
                    {
                        ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Cannot convert key index '{0}' into a property in the ExtensibleMessageInfo schema", keyValuePair.Key);
                    }
                }
            }
        }