Example #1
0
        public void Read(BinaryReader reader)
        {
            int num = reader.ReadInt32();

            this._messageText = reader.ReadString();
            List <OutboundAttachmentContainer> source = reader.ReadList <OutboundAttachmentContainer>();

            this._attachments.Clear();
            foreach (IOutboundAttachment outboundAttachment in source.Select <OutboundAttachmentContainer, IOutboundAttachment>((Func <OutboundAttachmentContainer, IOutboundAttachment>)(c => c.OutboundAttachment)))
            {
                this._attachments.Add(outboundAttachment);
            }
            this._outboundMessageStatus = (OutboundMessageStatus)reader.ReadInt32();
            if (this._outboundMessageStatus == OutboundMessageStatus.SendingNow)
            {
                this._outboundMessageStatus = OutboundMessageStatus.Failed;
            }
            this._deliveredMessageId = reader.ReadInt64();
            this._isChat             = reader.ReadBoolean();
            this._userOrChatId       = reader.ReadInt64();
            this._deliveryDateTime   = reader.ReadDateTime();
            this.StickerItem         = reader.ReadGeneric <StickerItemData>();
            if (num >= 2)
            {
                this.StickerReferrer = reader.ReadString();
            }
            if (num < 3)
            {
                return;
            }
            this.GraffitiAttachmentItem = reader.ReadGeneric <GraffitiAttachmentItem>();
        }
Example #2
0
 private void _outboundMessage_MessageSent(object sender, EventArgs e)
 {
     if (this._outboundMessage.OutboundMessageStatus == OutboundMessageStatus.Delivered)
     {
         this._message.date = Extensions.DateTimeToUnixTimestamp(this._outboundMessage.DeliveryDateTime, true);
         this._message.mid  = (int)this._outboundMessage.DeliveredMessageId;
         int index = 0;
         foreach (IOutboundAttachment outboundAttachment1 in this._outboundMessage.Attachments.Where <IOutboundAttachment>((Func <IOutboundAttachment, bool>)(a => !a.IsGeo)))
         {
             if (outboundAttachment1.IsUploadAttachment && outboundAttachment1 is OutboundPhotoAttachment && index < this._message.attachments.Count)
             {
                 Attachment          attachment          = this._message.attachments[index];
                 IOutboundAttachment outboundAttachment2 = outboundAttachment1;
                 if (attachment.photo != null && outboundAttachment2.GetAttachment().photo != null)
                 {
                     Photo photo = outboundAttachment2.GetAttachment().photo;
                     attachment.photo.aid      = photo.aid;
                     attachment.photo.pid      = photo.id;
                     attachment.photo.src      = photo.photo_130;
                     attachment.photo.src_big  = photo.photo_604;
                     attachment.photo.owner_id = photo.owner_id;
                 }
             }
             ++index;
         }
         if (this.GraffitiAttachment != null)
         {
             OutboundMessageViewModel outboundMessage = this._outboundMessage;
             Doc doc1;
             if (outboundMessage == null)
             {
                 doc1 = (Doc)null;
             }
             else
             {
                 GraffitiAttachmentItem graffitiAttachmentItem = outboundMessage.GraffitiAttachmentItem;
                 if (graffitiAttachmentItem == null)
                 {
                     doc1 = (Doc)null;
                 }
                 else
                 {
                     Attachment attachment = graffitiAttachmentItem.CreateAttachment();
                     doc1 = attachment != null ? attachment.doc : (Doc)null;
                 }
             }
             Doc doc2 = doc1;
             if (doc2 != null && this._message.attachments.Count > 0)
             {
                 Attachment attachment = this._message.attachments[0];
                 if (attachment.doc != null)
                 {
                     attachment.doc = doc2;
                 }
             }
         }
         this.EnsureCorrectOrderAfterDelivery();
     }
     this.RefreshUIProperties();
 }