コード例 #1
0
        /// <summary>
        /// Creates an array with messages received.
        /// </summary>
        /// <param name="response">Instance of response received.</param>
        /// <returns>Array with messages.</returns>
        internal static GetMessagesResponse[] CreateArray(ResponseBase response)
        {
            var resul = new List <GetMessagesResponse>();

            foreach (dynamic message in response.data)
            {
                string timeString = message.time;
                var    msg        = new GetMessagesResponse
                {
                    time       = DateTime.ParseExact(timeString, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToLocalTime(),
                    sender     = message.sender,
                    text       = message.text,
                    responseId = message.responseId
                };
                resul.Add(msg);
            }

            return(resul.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// Queries incoming messages received.
        /// </summary>
        /// <returns>Array with received messages.</returns>
        public GetMessagesResponse[] GetMessages()
        {
            ResponseBase response = this.makePetition("getmessages");

            return(GetMessagesResponse.CreateArray(response));
        }