Exemplo n.º 1
0
        public static int Compare(ObjectId a, ObjectId b)
        {
            MessageIdentity messageIdentity  = (MessageIdentity)a;
            MessageIdentity messageIdentity2 = (MessageIdentity)b;

            if (messageIdentity == messageIdentity2)
            {
                return(0);
            }
            if (messageIdentity == null && messageIdentity2 != null)
            {
                return(-1);
            }
            if (messageIdentity != null && messageIdentity2 == null)
            {
                return(1);
            }
            int num = messageIdentity.internalId.CompareTo(messageIdentity2.internalId);

            if (num != 0)
            {
                return(num);
            }
            return(QueueIdentity.Compare(messageIdentity.queueIdentity, messageIdentity2.queueIdentity));
        }
Exemplo n.º 2
0
        public static MessageIdentity ParsePattern(string identity, ref MatchOptions matchOptions)
        {
            MessageIdentity messageIdentity = MessageIdentity.InternalParse(identity, true);

            messageIdentity.QueueIdentity.ParseDomain(ref matchOptions);
            return(messageIdentity);
        }
Exemplo n.º 3
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.º 4
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);
                    }
                }
            }
        }
Exemplo n.º 5
0
 public static bool operator ==(MessageIdentity v1, MessageIdentity v2)
 {
     return(MessageIdentity.Compare(v1, v2) == 0);
 }
Exemplo n.º 6
0
 public static MessageIdentity Parse(string identity)
 {
     return(MessageIdentity.InternalParse(identity, false));
 }
Exemplo n.º 7
0
 public bool Match(MessageIdentity matchPattern, MatchOptions matchOptions)
 {
     return(this.internalId == matchPattern.internalId && this.queueIdentity.Match(matchPattern.queueIdentity, matchOptions));
 }