private MessageIdentity(PropertyStreamReader reader)
        {
            KeyValuePair <string, object> item;

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

            for (int i = 0; i < value; i++)
            {
                reader.Read(out item);
                if (string.Equals("InternalId", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.internalId = PropertyStreamReader.GetValue <long>(item);
                }
                else if (string.Equals("QueueIdentity", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.queueIdentity = QueueIdentity.Create(reader);
                }
                else
                {
                    ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Ignoring unknown property '{0} in messageIdentity", item.Key);
                }
            }
        }
 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)));
 }
        private PropertyBagBasedQueueInfo(PropertyStreamReader reader) : base(new QueueInfoPropertyBag())
        {
            KeyValuePair <string, object> item;

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

            for (int i = 0; i < value; i++)
            {
                reader.Read(out item);
                if (string.Equals(ExtensibleQueueInfoSchema.Identity.Name, item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    QueueIdentity value2 = QueueIdentity.Parse(PropertyStreamReader.GetValue <string>(item));
                    this[this.propertyBag.ObjectIdentityPropertyDefinition] = value2;
                }
                else if (string.Equals(ExtensibleQueueInfoSchema.DeliveryType.Name, item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    DeliveryType deliveryType = (DeliveryType)PropertyStreamReader.GetValue <int>(item);
                    this.propertyBag[ExtensibleQueueInfoSchema.DeliveryType] = deliveryType;
                }
                else if (string.Equals(ExtensibleQueueInfoSchema.Status.Name, item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    QueueStatus value3 = (QueueStatus)PropertyStreamReader.GetValue <int>(item);
                    this.propertyBag[ExtensibleQueueInfoSchema.Status] = value3;
                }
                else if (string.Equals(ExtensibleQueueInfoSchema.RiskLevel.Name, item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    RiskLevel value4 = (RiskLevel)PropertyStreamReader.GetValue <int>(item);
                    this.propertyBag[ExtensibleQueueInfoSchema.RiskLevel] = value4;
                }
                else if (string.Equals(ExtensibleQueueInfoSchema.NextHopCategory.Name, item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    NextHopCategory value5 = (NextHopCategory)PropertyStreamReader.GetValue <int>(item);
                    this.propertyBag[ExtensibleQueueInfoSchema.NextHopCategory] = value5;
                }
                else
                {
                    PropertyDefinition fieldByName = PropertyBagBasedQueueInfo.schema.GetFieldByName(item.Key);
                    if (fieldByName != null)
                    {
                        this.propertyBag.SetField((QueueViewerPropertyDefinition <ExtensibleQueueInfo>)fieldByName, item.Value);
                    }
                    else
                    {
                        ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Cannot convert key index '{0}' into a property in the ExtensibleQueueInfo schema", item.Key);
                    }
                }
            }
            if (this.propertyBag[ExtensibleQueueInfoSchema.NextHopDomain] != null)
            {
                QueueIdentity queueIdentity = (QueueIdentity)this[this.propertyBag.ObjectIdentityPropertyDefinition];
                queueIdentity.NextHopDomain = (string)this.propertyBag[ExtensibleQueueInfoSchema.NextHopDomain];
            }
        }
        internal MsgParser(string filePath)
        {
            CompoundFile compoundFile = new CompoundFile(filePath);

            _namedPropertyParser = new NamedPropertyParser(compoundFile);
            _propStreamReader    = new PropertyStreamReader(compoundFile);
            _recipientReader     = new RecipientReader(compoundFile);
            _attachmentReader    = new AttachmentReader(compoundFile);
        }
        private RecipientInfo(PropertyStreamReader reader)
        {
            KeyValuePair <string, object> item;

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

            for (int i = 0; i < value; i++)
            {
                reader.Read(out item);
                if (string.Equals("Address", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.address = PropertyStreamReader.GetValue <string>(item);
                }
                else if (string.Equals("Status", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.status = (RecipientStatus)PropertyStreamReader.GetValue <int>(item);
                }
                else if (string.Equals("LastError", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.lastError = PropertyStreamReader.GetValue <string>(item);
                }
                else if (string.Equals("Type", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.type = (MailRecipientType)PropertyStreamReader.GetValue <int>(item);
                }
                else if (string.Equals("LastErrorCode", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.lastErrorCode = PropertyStreamReader.GetValue <int>(item);
                }
                else if (string.Equals("FinalDestination", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.finalDestination = PropertyStreamReader.GetValue <string>(item);
                }
                else if (string.Equals("OutboundIPPool", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.outboundIPPool = PropertyStreamReader.GetValue <int>(item);
                }
                else
                {
                    ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Ignoring unknown property '{0} in recipientInfo", item.Key);
                }
            }
        }
Exemple #6
0
        private QueueIdentity(PropertyStreamReader reader)
        {
            KeyValuePair <string, object> item;

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

            for (int i = 0; i < value; i++)
            {
                reader.Read(out item);
                if (string.Equals("RowId", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.queueRowId = PropertyStreamReader.GetValue <long>(item);
                }
                else if (string.Equals("Type", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.queueType = (QueueType)PropertyStreamReader.GetValue <int>(item);
                }
                else if (string.Equals("NextHopDomain", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.nextHopDomain = PropertyStreamReader.GetValue <string>(item);
                }
                else if (string.Equals("Server", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.server = PropertyStreamReader.GetValue <string>(item);
                }
                else
                {
                    ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Ignoring unknown property '{0} in queueIdentity", item.Key);
                }
            }
        }
Exemple #7
0
        private ComponentLatencyInfo(PropertyStreamReader reader)
        {
            KeyValuePair <string, object> item;

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

            for (int i = 0; i < value; i++)
            {
                reader.Read(out item);
                if (string.Equals("Name", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.componentName = new LocalizedString(PropertyStreamReader.GetValue <string>(item));
                }
                else if (string.Equals("Latency", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.componentLatency = EnhancedTimeSpan.Parse(PropertyStreamReader.GetValue <string>(item));
                }
                else if (string.Equals("SequenceNumber", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.componentSequenceNumber = PropertyStreamReader.GetValue <int>(item);
                }
                else if (string.Equals("Pending", item.Key, StringComparison.OrdinalIgnoreCase))
                {
                    this.isPending = PropertyStreamReader.GetValue <bool>(item);
                }
                else
                {
                    ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Ignoring unknown property '{0} in ComponentLatencyInfo", item.Key);
                }
            }
        }
Exemple #8
0
 internal static QueueIdentity Create(PropertyStreamReader reader)
 {
     return(new QueueIdentity(reader));
 }
 internal static PropertyBagBasedQueueInfo CreateFromByteStream(PropertyStreamReader reader)
 {
     return(new PropertyBagBasedQueueInfo(reader));
 }
Exemple #10
0
 internal static PropertyBagBasedMessageInfo CreateFromByteStream(PropertyStreamReader reader, Version sourceVersion)
 {
     return(new PropertyBagBasedMessageInfo(reader, sourceVersion));
 }
Exemple #11
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);
                    }
                }
            }
        }
Exemple #12
0
 internal static ComponentLatencyInfo Create(PropertyStreamReader reader)
 {
     return(new ComponentLatencyInfo(reader));
 }
 internal static MessageIdentity Create(PropertyStreamReader reader)
 {
     return(new MessageIdentity(reader));
 }
 internal static RecipientInfo Create(PropertyStreamReader reader)
 {
     return(new RecipientInfo(reader));
 }