internal void ToByteArray(Version targetVersion, ref byte[] bytes, ref int offset) { if (targetVersion <= MessageIdentity.messageIdAsTextVersion) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Identity.Name, StreamPropertyType.String, this.ToString(), ref bytes, ref offset); return; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Identity.Name, StreamPropertyType.Int32, 1, ref bytes, ref offset); this.ToByteArray(ref bytes, ref offset); }
internal void ToByteArray(ref byte[] bytes, ref int offset) { int num = 0; PropertyStreamWriter.WritePropertyKeyValue("NumProperties", StreamPropertyType.Int32, 2, ref bytes, ref offset); PropertyStreamWriter.WritePropertyKeyValue("InternalId", StreamPropertyType.Int64, this.internalId, ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("QueueIdentity", StreamPropertyType.Int32, 1, ref bytes, ref offset); this.queueIdentity.ToByteArray(ref bytes, ref offset); num++; }
internal void ToByteArray(ref byte[] bytes, ref int offset) { int num = 0; PropertyStreamWriter.WritePropertyKeyValue("NumProperties", StreamPropertyType.Int32, 4, ref bytes, ref offset); PropertyStreamWriter.WritePropertyKeyValue("RowId", StreamPropertyType.Int64, this.queueRowId, ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("Type", StreamPropertyType.Int32, (int)this.queueType, ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("NextHopDomain", StreamPropertyType.String, this.nextHopDomain, ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("Server", StreamPropertyType.String, this.server, ref bytes, ref offset); num++; }
internal void ToByteArray(ref byte[] bytes, ref int offset) { int num = 0; PropertyStreamWriter.WritePropertyKeyValue("NumProperties", StreamPropertyType.Int32, 4, ref bytes, ref offset); PropertyStreamWriter.WritePropertyKeyValue("Name", StreamPropertyType.String, this.componentName.ToString(), ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("Latency", StreamPropertyType.String, this.componentLatency.ToString(), ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("SequenceNumber", StreamPropertyType.Int32, this.componentSequenceNumber, ref bytes, ref offset); num++; PropertyStreamWriter.WritePropertyKeyValue("Pending", StreamPropertyType.Bool, this.isPending, ref bytes, ref offset); num++; }
internal void ToByteArray(ref byte[] bytes, ref int offset) { int num = 6 + ((this.OutboundIPPool > 0) ? 1 : 0); int num2 = 0; PropertyStreamWriter.WritePropertyKeyValue("NumProperties", StreamPropertyType.Int32, num, ref bytes, ref offset); PropertyStreamWriter.WritePropertyKeyValue("Address", StreamPropertyType.String, this.address, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue("Status", StreamPropertyType.Int32, (int)this.Status, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue("Type", StreamPropertyType.Int32, (int)this.Type, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue("LastError", StreamPropertyType.String, this.LastError, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue("LastErrorCode", StreamPropertyType.Int32, this.LastErrorCode, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue("FinalDestination", StreamPropertyType.String, this.FinalDestination, ref bytes, ref offset); num2++; if (this.outboundIPPool > 0) { PropertyStreamWriter.WritePropertyKeyValue("OutboundIPPool", StreamPropertyType.Int32, this.outboundIPPool, ref bytes, ref offset); num2++; } }
internal void ToByteArray(ref byte[] bytes, ref int offset) { bool flag = this.DeferredMessageCountsPerPriority != null && this.DeferredMessageCountsPerPriority.Length > 0; bool flag2 = this.MessageCountsPerPriority != null && this.MessageCountsPerPriority.Length > 0; int num = 17 + ((this.LastRetryTime != null) ? 1 : 0) + ((this.NextRetryTime != null) ? 1 : 0) + ((this.FirstRetryTime != null) ? 1 : 0) + (flag ? 1 : 0) + (flag2 ? 1 : 0) + ((flag2 || flag) ? 1 : 0) + (string.IsNullOrEmpty(this.OverrideSource) ? 0 : 1); int num2 = 0; PropertyStreamWriter.WritePropertyKeyValue("NumProperties", StreamPropertyType.Int32, num, ref bytes, ref offset); PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.Identity.Name, StreamPropertyType.String, this.Identity.ToString(), ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.DeliveryType.Name, StreamPropertyType.Int32, (int)this.DeliveryType, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.NextHopDomain.Name, StreamPropertyType.String, this.NextHopDomain, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.NextHopConnector.Name, StreamPropertyType.Guid, this.NextHopConnector, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.Status.Name, StreamPropertyType.Int32, (int)this.Status, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.MessageCount.Name, StreamPropertyType.Int32, this.MessageCount, ref bytes, ref offset); num2++; if (flag2) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.MessageCountsPerPriority.Name, StreamPropertyType.Null | StreamPropertyType.Bool | StreamPropertyType.SByte | StreamPropertyType.Array, this.MessageCountsPerPriority, ref bytes, ref offset); num2++; } if (flag || flag2) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.PriorityDescriptions.Name, StreamPropertyType.Null | StreamPropertyType.Bool | StreamPropertyType.SByte | StreamPropertyType.UInt32 | StreamPropertyType.Array, base.PriorityDescriptions, ref bytes, ref offset); num2++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.LastError.Name, StreamPropertyType.String, this.LastError, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.RetryCount.Name, StreamPropertyType.Int32, this.RetryCount, ref bytes, ref offset); num2++; if (this.LastRetryTime != null) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.LastRetryTime.Name, StreamPropertyType.DateTime, this.LastRetryTime.Value, ref bytes, ref offset); num2++; } if (this.NextRetryTime != null) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.NextRetryTime.Name, StreamPropertyType.DateTime, this.NextRetryTime.Value, ref bytes, ref offset); num2++; } if (this.FirstRetryTime != null) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.FirstRetryTime.Name, StreamPropertyType.DateTime, this.FirstRetryTime.Value, ref bytes, ref offset); num2++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.TlsDomain.Name, StreamPropertyType.String, this.TlsDomain, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.DeferredMessageCount.Name, StreamPropertyType.Int32, this.DeferredMessageCount, ref bytes, ref offset); num2++; if (flag) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.DeferredMessageCountsPerPriority.Name, StreamPropertyType.Null | StreamPropertyType.Bool | StreamPropertyType.SByte | StreamPropertyType.Array, this.DeferredMessageCountsPerPriority, ref bytes, ref offset); num2++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.LockedMessageCount.Name, StreamPropertyType.Int32, this.LockedMessageCount, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.RiskLevel.Name, StreamPropertyType.Int32, (int)this.RiskLevel, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.OutboundIPPool.Name, StreamPropertyType.Int32, this.OutboundIPPool, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.NextHopCategory.Name, StreamPropertyType.Int32, (int)this.NextHopCategory, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.IncomingRate.Name, StreamPropertyType.Double, this.IncomingRate, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.OutgoingRate.Name, StreamPropertyType.Double, this.OutgoingRate, ref bytes, ref offset); num2++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.Velocity.Name, StreamPropertyType.Double, this.Velocity, ref bytes, ref offset); num2++; if (!string.IsNullOrEmpty(this.OverrideSource)) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleQueueInfoSchema.OverrideSource.Name, StreamPropertyType.String, this.OverrideSource, ref bytes, ref offset); num2++; } }
internal void ToByteArray(Version targetVersion, ref byte[] bytes, ref int offset) { int num = 17 + ((!string.IsNullOrEmpty(this.Subject)) ? 1 : 0) + ((this.SourceIP != null) ? 1 : 0) + ((this.ExpirationTime != null) ? 1 : 0) + ((this.DateReceived != DateTime.MinValue) ? 1 : 0); int num2; if (this.propertyBag.Contains(ExtensibleMessageInfoSchema.MessageLatency)) { EnhancedTimeSpan messageLatency = this.MessageLatency; num2 = 1; } else { num2 = 0; } int num3 = num + num2 + ((!string.IsNullOrEmpty(this.LastError)) ? 1 : 0) + ((this.Recipients != null && this.Recipients.Length > 0) ? 1 : 0) + ((this.ComponentLatency != null && this.ComponentLatency.Length > 0) ? 1 : 0) + ((this.OutboundIPPool > 0) ? 1 : 0) + ((this.ExternalDirectoryOrganizationId != Guid.Empty) ? 1 : 0); int num4 = 0; PropertyStreamWriter.WritePropertyKeyValue("NumProperties", StreamPropertyType.Int32, num3, ref bytes, ref offset); num4++; base.MessageIdentity.ToByteArray(targetVersion, ref bytes, ref offset); num4++; if (!string.IsNullOrEmpty(this.Subject)) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Subject.Name, StreamPropertyType.String, this.Subject, ref bytes, ref offset); num4++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.InternetMessageId.Name, StreamPropertyType.String, this.InternetMessageId, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.FromAddress.Name, StreamPropertyType.String, this.FromAddress, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Status.Name, StreamPropertyType.Int32, (int)this.Status, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Size.Name, StreamPropertyType.UInt64, this.Size.ToBytes(), ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.MessageSourceName.Name, StreamPropertyType.String, this.MessageSourceName, ref bytes, ref offset); num4++; if (this.SourceIP != null) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.SourceIP.Name, StreamPropertyType.IPAddress, this.SourceIP, ref bytes, ref offset); num4++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.SCL.Name, StreamPropertyType.Int32, this.SCL, ref bytes, ref offset); num4++; if (this.DateReceived != DateTime.MinValue) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.DateReceived.Name, StreamPropertyType.DateTime, this.DateReceived, ref bytes, ref offset); num4++; } if (this.ExpirationTime != null) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.ExpirationTime.Name, StreamPropertyType.DateTime, this.ExpirationTime, ref bytes, ref offset); num4++; } if (!string.IsNullOrEmpty(this.LastError)) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.LastError.Name, StreamPropertyType.String, this.LastError, ref bytes, ref offset); num4++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.LastErrorCode.Name, StreamPropertyType.Int32, this.LastErrorCode, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.RetryCount.Name, StreamPropertyType.Int32, this.RetryCount, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.MessageSourceName.Name, StreamPropertyType.String, this.MessageSourceName, ref bytes, ref offset); num4++; if (this.propertyBag.Contains(ExtensibleMessageInfoSchema.MessageLatency)) { EnhancedTimeSpan messageLatency2 = this.MessageLatency; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.MessageLatency.Name, StreamPropertyType.String, this.MessageLatency.ToString(), ref bytes, ref offset); num4++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.LockReason.Name, StreamPropertyType.String, this.LockReason, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.IsProbeMessage.Name, StreamPropertyType.Bool, this.IsProbeMessage, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.DeferReason.Name, StreamPropertyType.String, this.DeferReason, ref bytes, ref offset); PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Priority.Name, StreamPropertyType.String, this.Priority, ref bytes, ref offset); num4++; if (this.OutboundIPPool > 0) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.OutboundIPPool.Name, StreamPropertyType.Int32, this.OutboundIPPool, ref bytes, ref offset); num4++; } if (this.ExternalDirectoryOrganizationId != Guid.Empty) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId.Name, StreamPropertyType.Guid, this.ExternalDirectoryOrganizationId, ref bytes, ref offset); num4++; } PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Directionality.Name, StreamPropertyType.Int32, this.Directionality, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.OriginalFromAddress.Name, StreamPropertyType.String, this.OriginalFromAddress, ref bytes, ref offset); num4++; PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.AccountForest.Name, StreamPropertyType.String, this.AccountForest, ref bytes, ref offset); num4++; if (this.Recipients != null && this.Recipients.Length > 0) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.Recipients.Name, StreamPropertyType.Int32, this.Recipients.Length, ref bytes, ref offset); foreach (RecipientInfo recipientInfo in this.Recipients) { recipientInfo.ToByteArray(ref bytes, ref offset); } num4++; } if (this.ComponentLatency != null && this.ComponentLatency.Length > 0) { PropertyStreamWriter.WritePropertyKeyValue(ExtensibleMessageInfoSchema.ComponentLatency.Name, StreamPropertyType.Int32, this.ComponentLatency.Length, ref bytes, ref offset); foreach (ComponentLatencyInfo componentLatencyInfo in this.ComponentLatency) { componentLatencyInfo.ToByteArray(ref bytes, ref offset); } num4++; } }