/// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static DAO.MessageProperty ToDao(this MessageProperty obj, DAO.Message msg)
        {
            if (obj == null)
            {
                return(null);
            }

            #region Validate parameters
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }
            #endregion

            var dao = new DAO.MessageProperty();
            dao.Comment = obj.Comment;
            dao.Format  = obj.Format;
            dao.LINK    = obj.LINK;
            dao.Message = msg;
            dao.Name    = obj.Name;
            dao.Type    = obj.Type;
            dao.Value   = obj.Value;

            return(dao);
        }
 private static void CheckParams(MessageProperty property)
 {
     if (property == null)
     {
         throw new ArgumentNullException(nameof(property));
     }
     CheckParams(property.Name, property.Value);
 }
        /// <summary>
        /// Создание копии объекта без LINK и MessageLINK.
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        public static MessageProperty Copy(this MessageProperty src)
        {
            MessageProperty dest = mapper.Map <MessageProperty, MessageProperty>(src);

            dest.LINK        = 0;
            dest.MessageLINK = null;

            return(dest);
        }
示例#4
0
 public string GetProperty(MessageProperty property)
 {
     foreach (var prop in PC.Properties)
     {
         if (prop.Value.ID == property)
         {
             return(MessagePropertyTypes.PropertyToString(unicode, prop.Value));
         }
     }
     return(null);
 }
示例#5
0
        public BouyomiTalks(BinaryReader binaryReader)
        {
            Command = binaryReader.ReadInt16();
            Speed   = binaryReader.ReadInt16();
            Tone    = binaryReader.ReadInt16();
            Volume  = binaryReader.ReadInt16();
            Voice   = binaryReader.ReadInt16();
            var bCode    = binaryReader.ReadByte();
            var iLength  = binaryReader.ReadInt32();
            var bMessage = binaryReader.ReadBytes(iLength);

            MessageProp = new MessageProperty(bCode, iLength, bMessage);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dao"></param>
        /// <returns></returns>
        public static MessageProperty ToObj(this DAO.MessageProperty dao)
        {
            if (dao == null)
            {
                return(null);
            }

            var obj = new MessageProperty();

            obj.Comment     = dao.Comment;
            obj.Format      = dao.Format;
            obj.LINK        = dao.LINK;
            obj.MessageLINK = dao.Message.LINK;
            obj.Name        = dao.Name;
            obj.Type        = dao.Type;
            obj.Value       = dao.Value;

            return(obj);
        }
示例#7
0
 set => this.SetValue(MessageProperty, value);
示例#8
0
        private static IEnumerable <SubmitMessage> CreateSubmitMessageObjects(SubmitMessageViewModel submitInfo)
        {
            string CreatePayloadId(PayloadInfoViewModel payloadInfo, string messageId)
            {
                string name = Path.GetFileNameWithoutExtension(payloadInfo.FileName);

                if (submitInfo.NumberOfSubmitMessages > 1)
                {
                    return($"{messageId}.{name}");
                }

                return(name);
            }

            for (int i = 0; i < submitInfo.NumberOfSubmitMessages; i++)
            {
                var submitMessage = new SubmitMessage {
                    MessageInfo = { MessageId = $"{Guid.NewGuid().ToString()}@{Environment.MachineName}" }
                };
                submitMessage.Collaboration.AgreementRef.PModeId = submitInfo.SendingPMode.Id;

                var originalSenderProperty = new MessageProperty("originalSender",
                                                                 submitInfo.SendingPMode.MessagePackaging.PartyInfo.FromParty.PartyIds.First().Id);

                var finalRecipientProperty = new MessageProperty("finalRecipient",
                                                                 submitInfo.SendingPMode.MessagePackaging.PartyInfo.ToParty.PartyIds.First().Id);

                submitMessage.MessageProperties = new[] { originalSenderProperty, finalRecipientProperty };

                var payloads = new List <Payload>();

                foreach (var payloadInfo in submitInfo.PayloadInformation)
                {
                    var messagePayload = new Payload
                    {
                        Id       = CreatePayloadId(payloadInfo, submitMessage.MessageInfo.MessageId),
                        Location = $"file:///{payloadInfo.FileName}",
                        MimeType = MimeMapping.GetMimeMapping(Path.GetFileName(payloadInfo.FileName))
                    };

                    if (messagePayload.MimeType.Equals("text/xml", StringComparison.OrdinalIgnoreCase))
                    {
                        messagePayload.MimeType = "application/xml";
                    }

                    if (payloadInfo.IncludeSEDPartType)
                    {
                        messagePayload.PayloadProperties = new[] { new PayloadProperty("PartType")
                                                                   {
                                                                       Value = "SED"
                                                                   }, };
                    }

                    payloads.Add(messagePayload);
                }

                submitMessage.Payloads = payloads.ToArray();

                yield return(submitMessage);
            }
        }
示例#9
0
 set => base.SetValue(MessageProperty, value);
示例#10
0
 get => (DiscordMessage)GetValue(MessageProperty); set => SetValue(MessageProperty, value);
示例#11
0
 public abstract T VisitMessageProperty(MessageProperty m);
示例#12
0
 public void Configure(Action <MessageProperty> configure)
 {
     MessageProperties = new MessageProperty();
     configure(MessageProperties);
 }
示例#13
0
 public Message(string textMessage, DateTime time, MessageProperty messageProperty)
 {
     TextMessage     = textMessage;
     Time            = time;
     MessageProperty = messageProperty;
 }
示例#14
0
 public void SetMessage(string message, MessageProperty.MessageEncode messageEncode)
 {
     MessageProp = new MessageProperty(message, messageEncode);
 }
 /// <summary>
 /// Create a new instance of <see cref="ExtraMessageProperty"/>.
 /// </summary>
 /// <param name="property"></param>
 public ExtraMessageProperty(MessageProperty property)
 {
     CheckParams(property);
     Name  = property.Name;
     Value = property.Value;
 }
 set => SetValue(MessageProperty, value);
示例#17
0
 /// <summary>
 /// As extra message property
 /// </summary>
 /// <param name="property"></param>
 /// <returns></returns>
 public static ExtraMessageProperty AsExtra(this MessageProperty property) => new ExtraMessageProperty(property);