private static int GetEvmAttachmentOrder(string evmAttachmentOrder, string attachmentName) { if (string.IsNullOrEmpty(evmAttachmentOrder) || string.IsNullOrEmpty(attachmentName)) { return(-1); } int endIndex = evmAttachmentOrder.Length; int num = 1; for (int i = evmAttachmentOrder.Length - 1; i >= -1; i--) { if (i == -1 || evmAttachmentOrder[i] == ';') { if (Xso14AttachmentsProperty.ContainsAttachmentName(evmAttachmentOrder, i + 1, endIndex, attachmentName)) { return(num); } endIndex = i; if (i != evmAttachmentOrder.Length - 1) { num++; } } } return(-1); }
protected override Attachment12Data GetAttachmentData(Item message, Attachment attachment, string idbase, ref int index) { Attachment14Data attachment14Data = (Attachment14Data)base.GetAttachmentData(message, attachment, idbase, ref index); if (attachment14Data == null) { return(null); } if (this.IsEvmMessage()) { if (this.evmAttachmentOrders == null && base.Count > 1) { this.evmAttachmentOrders = new List <int>(base.Count); } attachment14Data.Order = Xso14AttachmentsProperty.GetEvmAttachmentOrder(message.GetValueOrDefault <string>(MessageItemSchema.VoiceMessageAttachmentOrder), attachment14Data.DisplayName); if (this.evmAttachmentOrders != null) { if (this.evmAttachmentOrders.Contains(attachment14Data.Order)) { attachment14Data.Order = -1; } else { this.evmAttachmentOrders.Add(attachment14Data.Order); } } if (Xso14AttachmentsProperty.IsTheLatestEvmAttachment(attachment14Data.Order)) { attachment14Data.Duration = message.GetValueOrDefault <int>(MessageItemSchema.VoiceMessageDuration, -1); } } return(attachment14Data); }