示例#1
0
        public GetUpdatesResponse GetUpdates(DateTime fromDate, DateTime toDate, GetUpdatesOptions options)
        {
            const string invalidDateTimeArgumentExceptionText =
                "Argument can not be equal to DateTime.MinValue or DateTime.MaxValue";

            if(fromDate == DateTime.MinValue || fromDate == DateTime.MaxValue)
            {
                throw new ArgumentException(invalidDateTimeArgumentExceptionText, "fromDate");
            }

            if (toDate == DateTime.MinValue || toDate == DateTime.MaxValue)
            {
                throw new ArgumentException(invalidDateTimeArgumentExceptionText, "toDate");
            }

            byte[] updates;

            double fromDateUnixConverted = UnixTimeConverter.Instance.ToUnixTime(fromDate);
            double toDateUnixConverted = UnixTimeConverter.Instance.ToUnixTime(toDate);

            string status = _service.get_updates(_apiKey, _token, (long)fromDateUnixConverted, (long)toDateUnixConverted, options.ToStringArray(), out updates);

            return new GetUpdatesResponse
                   	{
                   		Status = StatusMessageParser.ParseGetUpdatesStatus(status)
                   	};
        }
 public static bool Contains(this GetUpdatesOptions getUpdatesOptions, GetUpdatesOptions option)
 {
     return (getUpdatesOptions & option) == option;
 }